forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PHP-8.3: Fix phpGH-15918: Assertion failure in ext/spl/spl_fixedarray.c
- Loading branch information
Showing
4 changed files
with
26 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,16 @@ | ||
--TEST-- | ||
SplFixedArray properties is compatible with ArrayObject | ||
SplFixedArray properties is incompatible with ArrayObject | ||
--FILE-- | ||
<?php | ||
$ao = new ArrayObject([1, 2, 3]); | ||
$fixedArray = new SplFixedArray(1); | ||
$fixedArray[0] = new SplDoublyLinkedList(); | ||
$ao->exchangeArray($fixedArray); | ||
$ao[0] = new stdClass(); | ||
var_dump($ao); | ||
try { | ||
// See GH-15918: this *should* fail to not break invariants | ||
$ao->exchangeArray($fixedArray); | ||
} catch (InvalidArgumentException $e) { | ||
echo $e->getMessage(), "\n"; | ||
} | ||
?> | ||
--EXPECT-- | ||
object(ArrayObject)#1 (1) { | ||
["storage":"ArrayObject":private]=> | ||
object(SplFixedArray)#2 (2) { | ||
[0]=> | ||
object(SplDoublyLinkedList)#3 (2) { | ||
["flags":"SplDoublyLinkedList":private]=> | ||
int(0) | ||
["dllist":"SplDoublyLinkedList":private]=> | ||
array(0) { | ||
} | ||
} | ||
["0"]=> | ||
object(stdClass)#4 (0) { | ||
} | ||
} | ||
} | ||
Overloaded object of type SplFixedArray is not compatible with ArrayObject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--TEST-- | ||
GH-15918 (Assertion failure in ext/spl/spl_fixedarray.c) | ||
--FILE-- | ||
<?php | ||
$foo = new SplFixedArray(5); | ||
try { | ||
$arrayObject = new ArrayObject($foo); | ||
} catch (InvalidArgumentException $e) { | ||
echo $e->getMessage(), "\n"; | ||
} | ||
?> | ||
--EXPECT-- | ||
Overloaded object of type SplFixedArray is not compatible with ArrayObject |