-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Deprecate returning non-string values from a user output handler #18932
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
DanielEScherzer
merged 15 commits into
php:master
from
DanielEScherzer:output-handler-non-string
Jul 7, 2025
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
8d702ca
Deprecate returning non-string values from a user output handler
DanielEScherzer d213952
Only disable the problematic output handler
DanielEScherzer 25c1183
Tests
DanielEScherzer cb1026a
upgrading
DanielEScherzer 52f5e47
Handlers might be freed from OOM
DanielEScherzer 5781571
Location not always given
DanielEScherzer 470b7e9
context is also unavailable
DanielEScherzer 7710240
No tabs
DanielEScherzer 541028c
Memory limits
DanielEScherzer 87756d7
Update tests for rebase
DanielEScherzer 47c9836
Better variable name
DanielEScherzer 198a391
Test returning objects
DanielEScherzer 40aa105
More test fixes
DanielEScherzer 1cb076f
Update exception_handler.phpt
DanielEScherzer 0882664
Variable name + tests
DanielEScherzer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Handlers might be freed from OOM
- Loading branch information
commit 52f5e47f10c4f489d64ab8d0f1babf08a8c45fe4
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
tests/output/ob_start_callback_bad_return/handler_removed.phpt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--TEST-- | ||
ob_start(): Check behaviour with deprecation when OOM triggers handler removal | ||
--FILE-- | ||
DanielEScherzer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<?php | ||
|
||
ob_start(function() { | ||
// We are out of memory, now trigger a deprecation | ||
return false; | ||
}); | ||
|
||
$a = []; | ||
// trigger OOM in a resize operation | ||
while (1) { | ||
$a[] = 1; | ||
} | ||
|
||
?> | ||
--EXPECTF-- | ||
Deprecated: main(): Returning a non-string result from user output handler Closure::__invoke is deprecated in %s on line %d | ||
|
||
Fatal error: Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes) in %s on line %d |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.