From: pickwd at videotron dot ca
Operating system: WINXP
PHP version: 5.0.2
PHP Bug Type: Class/Object related
Bug description: serialize private
Description:
------------
Some on can explain me that:
<?
class B {
public $v;
}
class A {
private $v;
}
$a= new A();
$b= new B();
$sa1= 'O:1:"A":1:{s:4:"Av";N;}';//Text of serialized A
$sb1= 'O:1:"B":1:{s:1:"v";N;}';//Text of serialized B
$a1= unserialize($sa1);
$b1= unserialize($sb1);
print_r($a1);//Weird
print_r($b1);//ok B Object ( [v] => )
$sa= serialize($a);
$sb= serialize($b);
$a= unserialize($sa);
$b= unserialize($sb);
print_r($a);//ok A Object ( [v:private] => )
print_r($b);//ok B Object ( [v] => )
?>
If I serialise object with private member I'm unable unserialise it!
Reproduce code:
---------------
<?
class B {
public $v;
}
class A {
private $v;
}
$a= new A();
$b= new B();
$sa1= 'O:1:"A":1:{s:4:"Av";N;}';//Text of serialized A
$sb1= 'O:1:"B":1:{s:1:"v";N;}';//Text of serialized B
$a1= unserialize($sa1);
$b1= unserialize($sb1);
print_r($a1);//Weird
print_r($b1);//ok B Object ( [v] => )
$sa= serialize($a);
$sb= serialize($b);
$a= unserialize($sa);
$b= unserialize($sb);
print_r($a);//ok A Object ( [v:private] => )
print_r($b);//ok B Object ( [v] => )
?>
Expected result:
----------------
The print of the A unserialize
Actual result:
--------------
nothing
--
Edit bug report at http://bugs.php.net/?id=30417&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30417&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30417&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30417&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30417&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30417&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30417&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30417&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30417&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30417&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30417&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30417&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30417&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30417&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30417&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30417&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30417&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30417&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30417&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30417&r=mysqlcfg