You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Undefined Array Key with a Key as a Long String #13279
The example code is a simplified version of a WordPress plugin. It's really odd how array values can't be accessed by the keys here, yet they do exist. It is covered in a forum post at: WordPress.org. This is only in PHP 8.3, not 8.2,
In the meantime, I will try to create a simple version so you can replicate it.
@SVGAnimate I think you're on to something. The actual array does contain emoticons and more besides. I am still attempting to create the "simple" version using the review data from the WordPress plugin.
It is iterating through an array with keys that don't "exist". Even if the fault occurred before in the code, how is this possible?
I think this would be possible if the string is placed in the wrong bucket, i.e. if it was originally saved in one bucket and then the string+hash change. I suppose this could happen if there was a refcounting bug where the string is modified in-place.
Hmm yes. This is caused by #11060. The issue is that during the user call, the array is essentially unstable. I think this should be reverted for php_usort. /cc @nielsdos (I'm creating a PR)
[31-Jan-2024 12:13:58 UTC] PHP Warning: Undefined array key "1696007099_5_d386ca263816163166823ef00979d944" in array_test.php on line 44
[31-Jan-2024 12:13:58 UTC] PHP Warning: Trying to access array offset on null in array_test.php on line 44
[31-Jan-2024 12:13:58 UTC] PHP Warning: Undefined array key "1663066269_5_8c82ae69264d73f7ae7ce3a619501231" in array_test.php on line 44
[31-Jan-2024 12:13:58 UTC] PHP Warning: Trying to access array offset on null in array_test.php on line 44
Activity
iluuu1994 commentedon Jan 30, 2024
I don't see this warning. How are you running this code? Just in a CLI script?
designextreme commentedon Jan 30, 2024
I've attempted to simplify the PHP contained within a large script and may have failed in the process. I think I missed something with the array...
designextreme commentedon Jan 30, 2024
The example code is a simplified version of a WordPress plugin. It's really odd how array values can't be accessed by the keys here, yet they do exist. It is covered in a forum post at: WordPress.org. This is only in PHP 8.3, not 8.2,
In the meantime, I will try to create a simple version so you can replicate it.
SVGAnimate commentedon Jan 30, 2024
The mbstring extension has changed. I bet that's it.
designextreme commentedon Jan 30, 2024
@SVGAnimate I think you're on to something. The actual array does contain emoticons and more besides. I am still attempting to create the "simple" version using the review data from the WordPress plugin.
6 remaining items
iluuu1994 commentedon Jan 31, 2024
I think this would be possible if the string is placed in the wrong bucket, i.e. if it was originally saved in one bucket and then the string+hash change. I suppose this could happen if there was a refcounting bug where the string is modified in-place.
But let's wait for your reproducer.
designextreme commentedon Jan 31, 2024
Got it! Here is the simplified example:
I did try this with some multi-byte characters and emoticons, but this didn't affect the outcome.
SVGAnimate commentedon Jan 31, 2024
On PHP 8.3.1 i do not have Notice/Warning
iluuu1994 commentedon Jan 31, 2024
Hmm yes. This is caused by #11060. The issue is that during the user call, the array is essentially unstable. I think this should be reverted for
php_usort. /cc @nielsdos (I'm creating a PR)designextreme commentedon Jan 31, 2024
With PHP 8.3.2, here are the log entries:
Fix instable array during in-place modification in uksort
Fix instable array during in-place modification in uksort