|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #67453 Allow to unserialize empty data.
Submitted: 2014-06-16 12:17 UTC Modified: 2014-06-17 07:45 UTC
From: Assigned: remi (profile)
Status: Closed Package: SPL related
PHP Version: 5.6.0beta4 OS: irrevelant
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
New email:
PHP Version: OS:


 [2014-06-16 12:17 UTC]
SplDoublyLinkedList, SplObjectStorage and ArrayObject have empty constructor (no arg), so it make sense to allow to unserialize empty data.

This also the hack (used in various place, including PHPUnit) to instanciate class without call to constructor to work. 

Test script:
$a = new ArrayObject(array());

Expected result:
No error

Actual result:
Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Empty serialized string cannot be empty' in ...


php-unserialize.patch (last revision 2014-06-16 12:18 UTC by

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-06-16 12:18 UTC]
-Assigned To: +Assigned To: remi
 [2014-06-16 12:18 UTC]
The following patch has been added/updated:

Patch Name: php-unserialize.patch
Revision:   1402921120
 [2014-06-17 07:45 UTC]
-Status: Assigned +Status: Closed
 [2014-06-17 07:45 UTC]
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at

 For Windows:
Thank you for the report, and for helping us make PHP better.;a=commitdiff;h=ea466a316ffc39c7d5733c5aa1c37ab604af6e57
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Feb 21 19:01:29 2024 UTC