Skip to content

Commit

Permalink
Zend/tests/offsets: Add test for fetching reference of an object cont…
Browse files Browse the repository at this point in the history
…ainer
  • Loading branch information
Girgias committed Feb 19, 2024
1 parent e3683ea commit a45048b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Zend/tests/offsets/internal_handlers.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,24 @@ exportObject($o);
//}
//exportObject($o);

echo 'reference fetching', PHP_EOL;
$o = new DimensionHandlersNoArrayAccess();
try {
$r = &$o['foo'];
} catch (\Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
exportObject($o);

echo 'nested reference fetching', PHP_EOL;
$o = new DimensionHandlersNoArrayAccess();
try {
$r = &$o['foo']['bar'];
} catch (\Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
exportObject($o);

?>
--EXPECTF--
read op
Expand Down Expand Up @@ -254,3 +272,12 @@ nested unset
Notice: Indirect modification of overloaded element of DimensionHandlersNoArrayAccess has no effect in %s on line %d
Error: Cannot unset offset in a non-array variable
DimensionHandlersNoArrayAccess, read: true, write: false, has: false, unset: false, readType: BP_VAR_UNSET, hasOffset: true, checkEmpty: uninitialized, offset: 'foo'
reference fetching

Notice: Indirect modification of overloaded element of DimensionHandlersNoArrayAccess has no effect in %s on line %d
DimensionHandlersNoArrayAccess, read: true, write: false, has: false, unset: false, readType: BP_VAR_W, hasOffset: true, checkEmpty: uninitialized, offset: 'foo'
nested reference fetching

Notice: Indirect modification of overloaded element of DimensionHandlersNoArrayAccess has no effect in %s on line %d
Error: Cannot use a scalar value as an array
DimensionHandlersNoArrayAccess, read: true, write: false, has: false, unset: false, readType: BP_VAR_W, hasOffset: true, checkEmpty: uninitialized, offset: 'foo'

0 comments on commit a45048b

Please sign in to comment.