Skip to content

Commit a45048b

Browse files
committed
Zend/tests/offsets: Add test for fetching reference of an object container
1 parent e3683ea commit a45048b

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Zend/tests/offsets/internal_handlers.phpt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,24 @@ exportObject($o);
191191
//}
192192
//exportObject($o);
193193

194+
echo 'reference fetching', PHP_EOL;
195+
$o = new DimensionHandlersNoArrayAccess();
196+
try {
197+
$r = &$o['foo'];
198+
} catch (\Throwable $e) {
199+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
200+
}
201+
exportObject($o);
202+
203+
echo 'nested reference fetching', PHP_EOL;
204+
$o = new DimensionHandlersNoArrayAccess();
205+
try {
206+
$r = &$o['foo']['bar'];
207+
} catch (\Throwable $e) {
208+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
209+
}
210+
exportObject($o);
211+
194212
?>
195213
--EXPECTF--
196214
read op
@@ -254,3 +272,12 @@ nested unset
254272
Notice: Indirect modification of overloaded element of DimensionHandlersNoArrayAccess has no effect in %s on line %d
255273
Error: Cannot unset offset in a non-array variable
256274
DimensionHandlersNoArrayAccess, read: true, write: false, has: false, unset: false, readType: BP_VAR_UNSET, hasOffset: true, checkEmpty: uninitialized, offset: 'foo'
275+
reference fetching
276+
277+
Notice: Indirect modification of overloaded element of DimensionHandlersNoArrayAccess has no effect in %s on line %d
278+
DimensionHandlersNoArrayAccess, read: true, write: false, has: false, unset: false, readType: BP_VAR_W, hasOffset: true, checkEmpty: uninitialized, offset: 'foo'
279+
nested reference fetching
280+
281+
Notice: Indirect modification of overloaded element of DimensionHandlersNoArrayAccess has no effect in %s on line %d
282+
Error: Cannot use a scalar value as an array
283+
DimensionHandlersNoArrayAccess, read: true, write: false, has: false, unset: false, readType: BP_VAR_W, hasOffset: true, checkEmpty: uninitialized, offset: 'foo'

0 commit comments

Comments
 (0)