php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33892 serialize contains invalid chars
Submitted: 2005-07-27 22:42 UTC Modified: 2005-07-27 23:06 UTC
From: marcos dot neves at gmail dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.1.0b3 OS: any
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.
Password:
Status:
Package:
Bug Type:
Summary:
From: marcos dot neves at gmail dot com
New email:
PHP Version: OS:

 

 [2005-07-27 22:42 UTC] marcos dot neves at gmail dot com
Description:
------------
serialized string returned by serialize, contains invalid chars only when serializing an object with protected or private properties.

Reproduce code:
---------------
<?

class Foo {
	protected $bar = 123;
	//public $bar = 123;
}

$f = new Foo();

echo serialize($f);

?>

Expected result:
----------------
comment protected and uncomment public and the right result is given:

[[O:3:"Foo":1:{s:3:"bar";i:123;}]]

Actual result:
--------------
[[O:3:"Foo":1:{s:6:"
wich means:
[[O:3:"Foo":1:{s:6:"NULL*NULLbar";i:123;}]]
where NULL is the char \0

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-27 23:06 UTC] tony2001@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

See bug #29865.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 08:01:35 2024 UTC