1
0
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:
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

View File

@@ -0,0 +1,40 @@
--TEST--
SPL: ArrayObject::exchangeArray() and copy-on-write references
--FILE--
<?php
$ao = new ArrayObject();
$swapIn = array();
$cowRef = $swapIn; // create a copy-on-write ref to $swapIn
$ao->exchangeArray($swapIn);
$ao['a'] = 'adding element to $ao';
$swapIn['b'] = 'adding element to $swapIn';
$ao['c'] = 'adding another element to $ao';
echo "\n--> swapIn: ";
var_dump($swapIn);
echo "\n--> cowRef: ";
var_dump($cowRef);
echo "\n--> ao: ";
var_dump($ao);
?>
--EXPECTF--
--> swapIn: array(1) {
["b"]=>
string(25) "adding element to $swapIn"
}
--> cowRef: array(0) {
}
--> ao: object(ArrayObject)#%d (1) {
["storage":"ArrayObject":private]=>
array(2) {
["a"]=>
string(21) "adding element to $ao"
["c"]=>
string(29) "adding another element to $ao"
}
}