[php-src] Issue #13279: Undefined Array Key with a Key as a Long String
| From: | designextreme | Date: | Tue, 30 Jan 2024 18:33:06 +0000 |
| Subject: | [php-src] Issue #13279: Undefined Array Key with a Key as a Long String | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246368@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/13279
Author: designextreme
### Description
The following code:
```php
<?php
class array_test
{
public $array = array();
public function __construct()
{
$this->array = array(
'1696007099_5_d386ca263816163166823ef00979d944' => array(
'order' => 1
),
'1663066269_5_8c82ae69264d73f7ae7ce3a619501231' => array(
'order' => 0
)
);
uksort($this->array, function ($a, $b)
{
return $this->array[$a]['order'] - $this->array[$b]['order'];
}
);
}
}
new array_test;
```
Resulted in this output:
```
Warning: Undefined array key "1696007099_5_d386ca263816163166823ef00979d944" in
.../array_test.php on line 19
```
But I expected this output instead:
No warnings/errors, just a freshly sorted array.
I have tested the following:
```
echo $a; // 1696007099_5_d386ca263816163166823ef00979d944
echo $b; // 1663066269_5_8c82ae69264d73f7ae7ce3a619501231
echo array_key_exists($a, $this->array); // FALSE
echo isset($this->array[$a]); // FALSE
echo array_key_first($this->array); // 1696007099_5_d386ca263816163166823ef00979d944
echo array_keys($this->array)[0]; // 1696007099_5_d386ca263816163166823ef00979d944
```
### PHP Version
PHP 8.3
### Operating System
CentOS 7.9