1
0
mirror of https://github.com/php/php-src.git synced 2026-04-25 08:58:28 +02: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:
Gina Peter Banyard
2025-08-14 12:38:57 +01:00
committed by GitHub
parent 9c754baa99
commit fb87b14b6c
120 changed files with 353 additions and 136 deletions
@@ -0,0 +1,31 @@
--TEST--
get_object_vars() on ArrayObject works on the properties of the ArrayObject itself
--FILE--
<?php
class Test {
public $test;
public $test2;
}
class AO extends ArrayObject {
private $test;
public function getObjectVars() {
return get_object_vars($this);
}
}
$ao = new AO(new Test);
var_dump(get_object_vars($ao));
var_dump($ao->getObjectVars());
?>
--EXPECTF--
Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
array(0) {
}
array(1) {
["test"]=>
NULL
}