php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42919 Unserializing of namespaced class object fails
Submitted: 2007-10-10 15:29 UTC Modified: 2007-10-17 10:36 UTC
From: php at benjaminschulz dot com Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3CVS-2007-10-10 (CVS) OS:
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php at benjaminschulz dot com
New email:
PHP Version: OS:

 

 [2007-10-10 15:29 UTC] php at benjaminschulz dot com
Description:
------------
unserialize() fails at the namespace separator when unserializing objects of a class within a namespace

Reproduce code:
---------------
namespace foo;
class Bar {
}

var_dump(unserialize(serialize(new Bar))); 

Expected result:
----------------
object of Bar

Actual result:
--------------
Notice: unserialize(): Error at offset 8 of 19 bytes

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-12 08:43 UTC] daniel dot gorski at develnet dot org
Can reproduce with 5.3CVS-2007-10-12 (CVS), Linux

$php5/sapi/cli> ./php -r 'namespace foo; error_reporting(E_ALL); class Bar{}; var_dump(unserialize(serialize(new Bar)));'

Notice: unserialize(): Error at offset 8 of 19 bytes in Command line code on line 1

regards dtg
 [2007-10-17 10:36 UTC] dmitry@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Sep 19 05:00:01 2025 UTC