xref: /PHP-8.2/ext/opcache/tests/jit/gh12748.phpt (revision 2d65d714)
1--TEST--
2GH-12748: Function JIT emits "could not convert to int" warning at the same time as invalid offset Error
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6--FILE--
7<?php
8$container = "string";
9// Is
10try {
11    echo "isset():\n";
12    var_dump(isset($container[new stdClass()]));
13} catch (\Throwable $e) {
14    echo $e->getMessage(), "\n";
15}
16try {
17    echo "empty():\n";
18    var_dump(empty($container[new stdClass()]));
19} catch (\Throwable $e) {
20    echo $e->getMessage(), "\n";
21}
22try {
23    echo "Coalesce():\n";
24    var_dump($container[new stdClass()] ?? 'default');
25} catch (\Throwable $e) {
26    echo $e->getMessage(), "\n";
27}
28?>
29--EXPECT--
30isset():
31bool(false)
32empty():
33bool(true)
34Coalesce():
35Cannot access offset of type stdClass on string
36