11--TEST--
2- Appending containers via a read operation $c[][5] = $v;
2+ Appending containers via a fetch operation $c[][5] = $v;
33--FILE--
44<?php
55
66require_once __DIR__ . DIRECTORY_SEPARATOR . 'test_offset_helpers.inc ' ;
77
88foreach ($ containers as $ container ) {
9+ echo zend_test_var_export ($ container ), " container: \n" ;
910 try {
1011 $ container [][5 ] = 'value ' ;
1112 var_dump ($ container );
@@ -16,13 +17,15 @@ foreach ($containers as $container) {
1617
1718?>
1819--EXPECTF--
20+ NULL container:
1921array(1) {
2022 [0]=>
2123 array(1) {
2224 [5]=>
2325 string(5) "value"
2426 }
2527}
28+ false container:
2629
2730Deprecated: Automatic conversion of false to array is deprecated in %s on line %d
2831array(1) {
@@ -32,28 +35,39 @@ array(1) {
3235 string(5) "value"
3336 }
3437}
38+ true container:
3539Error: Cannot use a scalar value as an array
40+ 4 container:
3641Error: Cannot use a scalar value as an array
42+ 5.5 container:
3743Error: Cannot use a scalar value as an array
44+ '10' container:
3845Error: [] operator not supported for strings
46+ '25.5' container:
3947Error: [] operator not supported for strings
48+ 'string' container:
4049Error: [] operator not supported for strings
50+ [] container:
4151array(1) {
4252 [0]=>
4353 array(1) {
4454 [5]=>
4555 string(5) "value"
4656 }
4757}
58+ STDERR container:
4859Error: Cannot use a scalar value as an array
60+ new stdClass() container:
4961Error: Cannot use object of type stdClass as array
62+ new ArrayObject() container:
5063
5164Notice: Indirect modification of overloaded element of ArrayObject has no effect in %s on line %d
5265object(ArrayObject)#2 (1) {
5366 ["storage":"ArrayObject":private]=>
5467 array(0) {
5568 }
5669}
70+ new A() container:
5771string(12) "A::offsetGet"
5872NULL
5973
@@ -62,6 +76,7 @@ Notice: Indirect modification of overloaded element of A has no effect in %s on
6276Warning: Only the first byte will be assigned to the string offset in %s on line %d
6377object(A)#3 (0) {
6478}
79+ new B() container:
6580
6681Notice: Indirect modification of overloaded element of B has no effect in %s on line %d
6782ArgumentCountError: B::offsetGet(): Argument #1 ($offset) not passed
0 commit comments