Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pmmp/ext-recursionguard
Lightweight PHP extension to hard-cap function call depth.
https://github.com/pmmp/ext-recursionguard
github-actions-enabled php php-extension php80 php81 php82
Last synced: 5 days ago
JSON representation
Lightweight PHP extension to hard-cap function call depth.
- Host: GitHub
- URL: https://github.com/pmmp/ext-recursionguard
- Owner: pmmp
- Created: 2018-12-05T22:18:00.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-11-24T13:00:56.000Z (about 1 year ago)
- Last Synced: 2024-10-29T16:58:54.900Z (about 2 months ago)
- Topics: github-actions-enabled, php, php-extension, php80, php81, php82
- Language: C
- Homepage:
- Size: 28.3 KB
- Stars: 3
- Watchers: 8
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ext-recursionguard
![CI](https://github.com/pmmp/ext-recursionguard/workflows/CI/badge.svg)Lightweight PHP extension to hard-cap function call depth.
## Features
This extension will throw an `Error` if the function call stack reaches a depth of `256` calls. This is currently non-configurable, but usable for most cases.## Configuration
- `recursionguard.enabled` (default `1`): Controls whether the extension will guard for recursions even when loaded (useful for static builds).## Motivation
Recursion errors can be difficult to debug because they cause PHP to crash without any stack trace when something overrides `zend_execute_ex`. Therefore, it's desirable to have this barf at a hard limit instead of segfaulting without apparent reason.However, the only way to do this before now was the `xdebug` extension, which causes huge performance degradation and as such is unsuitable for production. This extension keeps to the point, causing a hit of only 10% extra function call overhead, versus `xdebug`'s 2000+% overhead. This additional overhead becomes insignificant outside of synthetic benchmarks.