Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Runner: add test for "out of memory" shutdown handler #1296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
jrfnl merged 1 commit into 3.x from php-8.5/runner-fix-out-of-memory-error-handling
Oct 23, 2025

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented Oct 23, 2025

Description

👉🏻 Note: this PR is pulled to the 3.x branch as runtime compatibility with new PHP versions is one of the few types of fixes still allowed to go into the 3.x branch. So if these tests would fail, the mitigation for that would need to go into the 3.x branch as a PHP runtime-compatibility fix.


PR squizlabs/PHP_CodeSniffer#3630 introduced a shutdown handler specifically to provide a more user-friendly error message when users run into "out of memory" errors. One of the challenges of doing this is making sure that enough memory is allocated for our own error message beforehand to make sure that the error message can still be created and displayed properly, even though PHP has already run out of memory.

As of PHP 8.5, a new fatal_error_backtraces ini setting has been added and enabled by default, which adds a backtrace to fatal errors, which could have an impact on this memory allocation.

If the sub-vote to default to "1" passes, messages for fatal errors will now contain backtraces and may not match the format existing code is expecting.

As this may (or may not) impact the shutdown function in PHPCS, I'm adding some end-to-end tests to safeguard this functionality.

Also reserving a little extra memory for the base message to be safer anyway.

Ref: https://wiki.php.net/rfc/error_backtraces_v2#backward_incompatible_changes

Suggested changelog entry

N/A (test only change - unless the tests would fail)

@jrfnl jrfnl added this to the 3.13.5 milestone Oct 23, 2025
@jrfnl jrfnl force-pushed the php-8.5/runner-fix-out-of-memory-error-handling branch 3 times, most recently from 1ab76a9 to 622ea7b Compare October 23, 2025 15:25
Copy link
Member Author

jrfnl commented Oct 23, 2025

Sorry about the commit noise, trying to get this working without being able to verify locally.

@jrfnl jrfnl force-pushed the php-8.5/runner-fix-out-of-memory-error-handling branch from bd1edba to ae20d34 Compare October 23, 2025 15:36
PR squizlabs/PHP_CodeSniffer 3630 introduced a shutdown handler specifically to provide a more user-friendly error message when users run into "out of memory" errors.
One of the challenges of doing this is making sure that enough memory is allocated for our own error message beforehand to make sure that the error message can still be created and displayed properly, even though PHP has already run out of memory.
As of PHP 8.5, a new `fatal_error_backtraces` ini setting has been added and enabled by default, which adds a backtrace to fatal errors, which could have an impact on this memory allocation.
> If the sub-vote to default to "1" passes, messages for fatal errors will now contain backtraces and may not match the format existing code is expecting.
As this _may_ (or may not) impact the shutdown function in PHPCS, I'm adding some end-to-end tests to safeguard this functionality.
Also reserving a little extra memory for the base message to be safer anyway.
Ref: https://wiki.php.net/rfc/error_backtraces_v2#backward_incompatible_changes 
@jrfnl jrfnl force-pushed the php-8.5/runner-fix-out-of-memory-error-handling branch from ae20d34 to 2ce2d1a Compare October 23, 2025 15:49
Copy link
Member Author

jrfnl commented Oct 23, 2025

Also opened a related feature request for BashUnit: TypedDevs/bashunit#505

Chemaclass reacted with eyes emoji

@jrfnl jrfnl merged commit 883a948 into 3.x Oct 23, 2025
78 checks passed
@jrfnl jrfnl deleted the php-8.5/runner-fix-out-of-memory-error-handling branch October 23, 2025 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

3.13.5

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /