mirror of
https://github.com/php/php-src.git
synced 2026-03-24 16:22:37 +01:00
ext/spl: Deprecate ArrayObject and ArrayIterator with objects (#19420)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_arrayobject_and_arrayiterator_with_objects This also moves tests into a subfolder.
This commit is contained in:
committed by
GitHub
parent
9c754baa99
commit
fb87b14b6c
39
ext/spl/tests/ArrayObject/ArrayObject_illegal_offset.phpt
Normal file
39
ext/spl/tests/ArrayObject/ArrayObject_illegal_offset.phpt
Normal file
@@ -0,0 +1,39 @@
|
||||
--TEST--
|
||||
ArrayObject illegal offset
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$ao = new ArrayObject([1, 2, 3]);
|
||||
try {
|
||||
var_dump($ao[[]]);
|
||||
} catch (TypeError $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
try {
|
||||
$ao[[]] = new stdClass;
|
||||
} catch (TypeError $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
try {
|
||||
$ref =& $ao[[]];
|
||||
} catch (TypeError $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
try {
|
||||
var_dump(isset($ao[[]]));
|
||||
} catch (TypeError $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
try {
|
||||
unset($ao[[]]);
|
||||
} catch (TypeError $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Cannot access offset of type array on ArrayObject
|
||||
Cannot access offset of type array on ArrayObject
|
||||
Cannot access offset of type array on ArrayObject
|
||||
Cannot access offset of type array in isset or empty
|
||||
Cannot unset offset of type array on ArrayObject
|
||||
Reference in New Issue
Block a user