Bug #66085 [Csd]: in function serialize() there is irregular behaviour
| From: | machine dot check dot exception at gmail dot com | Date: | Wed, 13 Nov 2013 11:21:38 +0000 |
| Subject: | Bug #66085 [Csd]: in function serialize() there is irregular behaviour | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-182730@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66085&edit=1
ID: 66085
User updated by: machine dot check dot exception at gmail dot com
Reported by: machine dot check dot exception at gmail dot com
Summary: in function serialize() there is irregular behaviour
Status: Closed
Type: Bug
Package: Arrays related
Operating System: Windows 7
PHP Version: 5.5.5
Assigned To: bwoebi
Block user comment: N
Private report: N
New Comment:
I have this version installed: VC11 x86 Thread Safe (2013-Oct-17 00:30:06)
From phpinfo():
Build Date Oct 15 2013 10:25:39
Compiler MSVC11 (Visual C++ 2012)
Architecture x86
And the bug is still there.
Previous Comments:
------------------------------------------------------------------------
[2013-11-12 20:37:43] bwoebi@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at
http://www.php.net/downloads.php
Have a look at: http://3v4l.org/GeU1o#v510 ⦠Was just
a bug until 5.5.4.
------------------------------------------------------------------------
[2013-11-12 20:21:15] machine dot check dot exception at gmail dot com
Description:
------------
Doing tests I found a different behaviour between versions of php.
The code in the test script returns in php 5.2.7, 5.3.0, 5.3.9, this:
O:8:"stdClass":1:{s:1:"a";s:4:"tmp1";}
O:8:"stdClass":1:{s:1:"a";s:4:"tmp2";}
In php 5.4.0RC8, 5.4.3 and 5.5.5 this:
O:8:"stdClass":1:{s:1:"a";s:4:"tmp1";}
r:3;
Test script:
---------------
class test implements Serializable {
public $a;
public function __construct( $_val ){
$this->a = $_val;
}
public function serialize() {
$tmp = (object) array();
$tmp->a = $this->a;
echo serialize( $tmp ) . "\n";
return serialize( $tmp );
}
}
$n = array();
$n[0] = new test('tmp1');
$n[1] = new test('tmp2');
print_r( unserialize( serialize( $n ) ) );
Expected result:
----------------
O:8:"stdClass":1:{s:1:"a";s:4:"tmp1";}
O:8:"stdClass":1:{s:1:"a";s:4:"tmp2";}
Actual result:
--------------
O:8:"stdClass":1:{s:1:"a";s:4:"tmp1";}
r:3;
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66085&edit=1