|  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
15 - 13 = ?
Subscribe to this entry?

 [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 18:01:29 2024 UTC