[php-src] Issue #12812: JIT: Integer string in variable used as offset produces wrong undefined array key warning
| From: | Girgias | Date: | Tue, 28 Nov 2023 13:02:18 +0000 |
| Subject: | [php-src] Issue #12812: JIT: Integer string in variable used as offset produces wrong undefined array key warning | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245917@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12812
Author: Girgias
### Description
Found while working on #12723
The following code:
```php
<?php
$container = [];
$dimension = '7';
try {
var_dump($container['7']);
} catch (\Throwable $e) {
echo $e->getMessage(), "\n";
}
try {
var_dump($container[$dimension]);
} catch (\Throwable $e) {
echo $e->getMessage(), "\n";
}
```
Resulted in this output:
```
Warning: Undefined array key 7 in %s on line %d
NULL
Warning: Undefined array key "7" in %s on line %d
NULL
```
But I expected this output instead:
```
Warning: Undefined array key 7 in %s on line %d
NULL
Warning: Undefined array key 7 in %s on line %d
NULL
```
### PHP Version
PHP 8.2
### Operating System
_No response_