xref: /PHP-7.4/Zend/tests/bug71300.phpt (revision 16a2b473)
1--TEST--
2Bug #71300 (Segfault in zend_fetch_string_offset)
3--FILE--
4<?php
5function test1() {
6	for ($n = 'a'; $n < 'g'; $n++) {
7		$$n = 1;
8	}
9	$$n = $$n[++$n] = "test";
10	return $$n;
11}
12
13var_dump(test1());
14
15function test2() {
16    /* See #71303 for why not using for loop here */
17	$n = "a";
18	$$n .= $$n[++$n] = "test";
19	return $$n;
20}
21
22var_dump(test2());
23?>
24--EXPECTF--
25string(4) "test"
26
27Notice: Array to string conversion in %sbug71300.php on line %d
28string(9) "Arraytest"
29