File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ Appending containers
3+ --FILE--
4+ <?php
5+
6+ $ containers = [
7+ null ,
8+ false ,
9+ true ,
10+ 10 ,
11+ 25.5 ,
12+ 'string ' ,
13+ [],
14+ new stdClass (),
15+ STDERR ,
16+ ];
17+
18+ foreach ($ containers as $ container ) {
19+ try {
20+ $ container [] = 'value ' ;
21+ var_dump ($ container );
22+ } catch (\Throwable $ e ) {
23+ echo $ e ->getMessage (), "\n" ;
24+ }
25+ }
26+
27+ ?>
28+ --EXPECT--
29+ array(1) {
30+ [0]=>
31+ string(5) "value"
32+ }
33+
34+ Deprecated: Automatic conversion of false to array is deprecated in /home/girgias/Dev/php-src/Zend/tests/offsets/appending_containers.php on line 17
35+ array(1) {
36+ [0]=>
37+ string(5) "value"
38+ }
39+ Cannot use a scalar value as an array
40+ Cannot use a scalar value as an array
41+ Cannot use a scalar value as an array
42+ [] operator not supported for strings
43+ array(1) {
44+ [0]=>
45+ string(5) "value"
46+ }
47+ Cannot use object of type stdClass as array
48+ Cannot use a scalar value as an array
You can’t perform that action at this time.
0 commit comments