summaryrefslogtreecommitdiff
path: root/Zend/tests/bug71300.phpt
blob: 40734b054933b2f2cc852689dffc08a8d2e0aba8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--TEST--
Bug #71300 (Segfault in zend_fetch_string_offset)
--FILE--
<?php
function test1() {
    for ($n = 'a'; $n < 'g'; $n++) {
        $$n = 1;
    }
    $$n = $$n[++$n] = "test";
    return $$n;
}

var_dump(test1());

function test2() {
    /* See #71303 for why not using for loop here */
    $n = "a";
    $$n .= $$n[++$n] = "test";
    return $$n;
}

var_dump(test2());
?>
--EXPECTF--
string(4) "test"

Warning: Array to string conversion in %s on line %d
string(9) "Arraytest"