From:             marcos dot neves at gmail dot com
Operating system: any
PHP version:      5.1.0b3
PHP Bug Type:     Unknown/Other Function
Bug description:  serialize contains invalid chars

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

-- 
Edit bug report at http://bugs.php.net/?id=33892&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33892&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33892&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33892&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33892&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33892&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33892&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33892&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33892&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33892&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33892&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33892&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33892&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33892&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33892&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33892&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33892&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33892&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33892&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33892&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33892&r=mysqlcfg

Reply via email to