xref: /PHP-8.1/Zend/tests/bug70089.phpt (revision 9ed2f489)
1--TEST--
2Bug #70089 (segfault in PHP 7 at ZEND_FETCH_DIM_W_SPEC_VAR_CONST_HANDLER ())
3--FILE--
4<?php
5function dummy($a) {
6}
7
8try {
9    chr(0)[0][] = 1;
10} catch (Error $e) {
11    var_dump($e->getMessage());
12}
13try {
14    unset(chr(0)[0][0]);
15} catch (Error $e) {
16    var_dump($e->getMessage());
17}
18eval("function runtimetest(&\$a) {} ");
19try {
20    runtimetest(chr(0)[0]);
21} catch (Error $e) {
22    var_dump($e->getMessage());
23}
24
25try {
26    ++chr(0)[0];
27} catch (Error $e) {
28    var_dump($e->getMessage());
29}
30?>
31--EXPECT--
32string(36) "Cannot use string offset as an array"
33string(27) "Cannot unset string offsets"
34string(41) "Only variables can be passed by reference"
35string(41) "Cannot increment/decrement string offsets"
36