xref: /php-src/ext/opcache/tests/jit/gh12812.phpt (revision 39a813d9)
1--TEST--
2GH-12812: JIT: Integer string in variable used as offset produces wrong undefined array key warning
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6--FILE--
7<?php
8
9$container = [];
10$dimension = '7';
11
12try {
13    var_dump($container['7']);
14} catch (\Throwable $e) {
15    echo $e->getMessage(), "\n";
16}
17try {
18    var_dump($container[$dimension]);
19} catch (\Throwable $e) {
20    echo $e->getMessage(), "\n";
21}
22
23?>
24--EXPECTF--
25Warning: Undefined array key 7 in %s on line %d
26NULL
27
28Warning: Undefined array key 7 in %s on line %d
29NULL
30