承接 interitty/infinite-loop-prevention 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

interitty/infinite-loop-prevention

最新稳定版本:v1.0.11

Composer 安装命令:

composer require interitty/infinite-loop-prevention

包简介

A simple infinite loop prevention tool.

README 文档

README

A simple infinite loop prevention tool that help developers to prevent the error Maximum function nesting level of '256' reached, aborting!.

Requirements

Installation

The best way to install interitty/infinite-loop-prevention is using Composer:

composer require interitty/infinite-loop-prevention

Usage

For cases when an infinite loop can happen, especially when code work with a given callback, it can be handy to call preventive assertion in a non-production environment just to be sure, that code can't fall into an infinite loop.

Because the code is based on debug_backtrace, it will be better to disable the mechanism on the production environment by setting the static InfiniteLoopPrevention::$productionMode variable.

If this check still needs to be performed in the production environment, for example, due to user input, the force parameter can be used on the checkFinite method.

For better performance in the production environment, it will be better to use the assert, because the execution and whole code generating can be disabled by the zend.assertions in the php.ini file.

It only needs to call the static method without any parameters just inside the method or function where the given callback is called.

Example: Usage of checkFinite()


function test(): void
{
    assert(InfiniteLoopPrevention::checkFinite());
    test();
}

test();

统计信息

  • 总下载量: 186
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-07-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固