xref: /PHP-5.5/tests/lang/bug22592.phpt (revision 4de15df7)
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[-1] = 'a';
36?>
37--EXPECT--
38string(5) "* *-*"
39string(7) "* *-* *"
40string(7) "*4*-* *"
41string(7) "*4*s* *"
42string(8) "*4*s* *0"
43string(8) "*-*-* *0"
44string(8) "*-*s*s*0"
45string(8) "4-4s4s*0"
46string(9) "4-4s4s505"
47string(9) "454s4s505"
48string(1) "-"
49string(1) "s"
50string(1) "4"
51string(1) "5"
52string(1) "5"
53[Illegal string offset:  -1]
54