-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
References to null-serializations are stored as null, and as such are part of the reference count. Reminds me that we really need to deprecate the mess that is Serializable.
- Loading branch information
Showing
3 changed files
with
34 additions
and
1 deletion.
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,31 @@ | ||
--TEST-- | ||
Bug #80411: References to null-serialized object break serialize() | ||
--FILE-- | ||
<?php | ||
|
||
class UnSerializable implements Serializable | ||
{ | ||
public function serialize() {} | ||
public function unserialize($serialized) {} | ||
} | ||
|
||
$unser = new UnSerializable(); | ||
$arr = [$unser]; | ||
$arr[1] = &$arr[0]; | ||
$arr[2] = 'endcap'; | ||
$arr[3] = &$arr[2]; | ||
|
||
$data = serialize($arr); | ||
echo $data . PHP_EOL; | ||
$recovered = unserialize($data); | ||
var_export($recovered); | ||
|
||
?> | ||
--EXPECT-- | ||
a:4:{i:0;N;i:1;N;i:2;s:6:"endcap";i:3;R:4;} | ||
array ( | ||
0 => NULL, | ||
1 => NULL, | ||
2 => 'endcap', | ||
3 => 'endcap', | ||
) |
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