[php-src] Issue #12748: Function JIT emits "could not convert to int" warning at the same time as invalid offset Error
| From: | Girgias | Date: | Wed, 22 Nov 2023 06:00:26 +0000 |
| Subject: | [php-src] Issue #12748: Function JIT emits "could not convert to int" warning at the same time as invalid offset Error | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245862@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12748
Author: Girgias
### Description
The following code:
```php
<?php
$container = "string";
// 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():
bool(false)
empty():
bool(true)
Coalesce():
Warning: Object of class stdClass could not be converted to int in %s on line %d
Cannot access offset of type stdClass on string
```
But I expected this output instead:
```
isset():
bool(false)
empty():
bool(true)
Coalesce():
Cannot access offset of type stdClass on string
```
Related to https://github.com/php/php-src/pull/12723
### PHP Version
PHP 8.2
### Operating System
_No response_