php-src/ext/spl/tests/ArrayObject_overloaded_SplFixedArray.phpt
Niels Dossche 9774cedb01
Fix GH-15918: Assertion failure in ext/spl/spl_fixedarray.c
SplFixedArray should've never get supported in ArrayObject because it's
overloaded, and so that breaks assumptions. This regressed in c4ecd82f.

Closes GH-15947.
2024-09-20 17:34:23 +02:00

16 lines
461 B
PHP

--TEST--
SplFixedArray properties is incompatible with ArrayObject
--FILE--
<?php
$ao = new ArrayObject([1, 2, 3]);
$fixedArray = new SplFixedArray(1);
$fixedArray[0] = new SplDoublyLinkedList();
try {
// See GH-15918: this *should* fail to not break invariants
$ao->exchangeArray($fixedArray);
} catch (InvalidArgumentException $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Overloaded object of type SplFixedArray is not compatible with ArrayObject