xref: /PHP-7.2/tests/lang/bug22592.phpt (revision 56fce899)
1--TEST--
2Bug #22592 (cascading assignments to strings with curly braces broken)
3--FILE--
4<?php
5function error_hdlr($errno, $errstr) {
6	echo "[$errstr]\n";
7}
8
9set_error_handler('error_hdlr');
10
11$i = 4;
12$s = "string";
13
14$result = "* *-*";
15var_dump($result);
16$result[6] = '*';
17var_dump($result);
18$result[1] = $i;
19var_dump($result);
20$result[3] = $s;
21var_dump($result);
22$result[7] = 0;
23var_dump($result);
24$a = $result[1] = $result[3] = '-';
25var_dump($result);
26$b = $result[3] = $result[5] = $s;
27var_dump($result);
28$c = $result[0] = $result[2] = $result[4] = $i;
29var_dump($result);
30$d = $result[6] = $result[8] = 5;
31var_dump($result);
32$e = $result[1] = $result[6];
33var_dump($result);
34var_dump($a, $b, $c, $d, $e);
35$result[0] = $result[-4] = $result[-1] = 'a';
36var_dump($result);
37?>
38--EXPECT--
39string(5) "* *-*"
40string(7) "* *-* *"
41string(7) "*4*-* *"
42string(7) "*4*s* *"
43string(8) "*4*s* *0"
44string(8) "*-*-* *0"
45string(8) "*-*s*s*0"
46string(8) "4-4s4s*0"
47string(9) "4-4s4s505"
48string(9) "454s4s505"
49string(1) "-"
50string(1) "s"
51string(1) "4"
52string(1) "5"
53string(1) "5"
54string(9) "a54s4a50a"
55