Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initialize SplFixedArray elements to NULL instead of UNDEF
The SplFixedArray API treats all elements as NULL, even if they have not been explicitly initialized. Rather than initializing to UNDEF an treating that specially in various circumstances, directly initialize elements to NULL. This also fixes an assertion failure in the attached test case.
- Loading branch information
Showing
2 changed files
with
33 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--TEST-- | ||
SplFixedArray indirect modification notice | ||
--FILE-- | ||
<?php | ||
$a = new SplFixedArray(1); | ||
$a[0][] = 3; | ||
var_dump($a); | ||
?> | ||
--EXPECTF-- | ||
Notice: Indirect modification of overloaded element of SplFixedArray has no effect in %s on line %d | ||
object(SplFixedArray)#1 (1) { | ||
[0]=> | ||
NULL | ||
} |