mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_arrayobject_and_arrayiterator_with_objects This also moves tests into a subfolder.
30 lines
633 B
PHP
30 lines
633 B
PHP
--TEST--
|
|
GH-11178 (Segmentation fault in spl_array_it_get_current_data (PHP 8.1.18))
|
|
--FILE--
|
|
<?php
|
|
#[AllowDynamicProperties]
|
|
class A implements IteratorAggregate {
|
|
function __construct() {
|
|
$this->{'x'} = 1;
|
|
}
|
|
|
|
function getIterator(): Traversable {
|
|
return new ArrayIterator($this);
|
|
}
|
|
}
|
|
|
|
$obj = new A;
|
|
|
|
foreach ($obj as $k => &$v) {
|
|
$v = 3;
|
|
}
|
|
|
|
var_dump($obj);
|
|
?>
|
|
--EXPECTF--
|
|
Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
|
|
object(A)#1 (1) {
|
|
["x"]=>
|
|
&int(3)
|
|
}
|