Fix GH-20194: null offset deprecation not emitted for writes#20238
Merged
Girgias merged 7 commits intophp:PHP-8.5from Oct 29, 2025
Merged
Fix GH-20194: null offset deprecation not emitted for writes#20238Girgias merged 7 commits intophp:PHP-8.5from
Girgias merged 7 commits intophp:PHP-8.5from
Conversation
Member
|
Not approving as it's still in draft, but looks good. Thanks for taking care of this! |
19555de to
aca79f0
Compare
arnaud-lb
reviewed
Oct 20, 2025
alexandre-daubois
approved these changes
Oct 24, 2025
dstogov
reviewed
Oct 27, 2025
Comment on lines
+6281
to
+6286
| } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { | ||
| zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); | ||
| if (UNEXPECTED(EG(exception))) { | ||
| zval_ptr_dtor_nogc(expr_ptr); | ||
| HANDLE_EXCEPTION(); | ||
| } |
Member
There was a problem hiding this comment.
You know, each new warning opens a way to modify some involved zval through the user error handler.
In this case, user error handler may probably unset() op1 and this may lead to use-after-free on attempt to add new element.
It's better to add related test(s) and fix problem at first place.
Member
There was a problem hiding this comment.
Member
Author
There was a problem hiding this comment.
Added a test case and fix.
ddfec36 to
6edd455
Compare
This is used by array_column(), the AST, and iterators
arnaud-lb
approved these changes
Oct 29, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Based on the patch from @nielsdos and split into different commits to explain what affects what.