[php-src] Issue #12747: Function JIT returns invalid error message for coalesce operator on invalid offset
| From: | Girgias | Date: | Wed, 22 Nov 2023 05:54:48 +0000 |
| Subject: | [php-src] Issue #12747: Function JIT returns invalid error message for coalesce operator on invalid offset | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245861@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12747
Author: Girgias
### Description
The following code:
```php
<?php
$container = [];
// Is
try {
echo "isset():\n";
var_dump(isset($container[new stdClass()]));
} catch (\Throwable $e) {
echo $e->getMessage(), "\n";
}
try {
echo "empty():\n";
var_dump(empty($container[new stdClass()]));
} catch (\Throwable $e) {
echo $e->getMessage(), "\n";
}
try {
echo "Coalesce():\n";
var_dump($container[new stdClass()] ?? 'default');
} catch (\Throwable $e) {
echo $e->getMessage(), "\n";
}
?>
```
Resulted in this output:
```
isset():
Cannot access offset of type stdClass in isset or empty
empty():
Cannot access offset of type stdClass in isset or empty
Coalesce():
Cannot access offset of type stdClass in isset or empty
```
But I expected this output instead:
```
isset():
Cannot access offset of type stdClass in isset or empty
empty():
Cannot access offset of type stdClass in isset or empty
Coalesce():
Cannot access offset of type stdClass on array
```
Related to #12723
### PHP Version
PHP 8.3
### Operating System
_No response_