Bug #66085 [Csd]: in function serialize() there is irregular behaviour

From: Date: Wed, 13 Nov 2013 12:53:44 +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-182732@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: Here is there info about the system i'm using from phpinfo(): PHP Version 5.5.5 System Windows NT XYZ-PC 6.1 build 7601 (Windows 7 Ultimate Edition Service Pack 1) i586 Build Date Oct 15 2013 10:25:39 Compiler MSVC11 (Visual C++ 2012) Architecture x86 Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--disable-isapi" "--enable-debug-pack" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=C:\php-sdk\oracle\instantclient11\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--disable-static-analyze" "--with-pgo" Server API Apache 2.0 Handler Virtual Directory Support enabled Configuration File (php.ini) Path C:\Windows Loaded Configuration File F:\wamp\bin\apache\apache2.4.6\bin\php.ini Apache Version Apache/2.4.6 (Win32) PHP/5.5.5 Apache API Version 20120211 http://3v4l.org/GeU1o#v510 is running under linux. Can it be somethin just related with the windows version? Previous Comments: ------------------------------------------------------------------------ [2013-11-13 12:28:03] bwoebi@php.net Are you sure that that is PHP 5.5.5? At least I can't reproduce it here with 5.5.5 here. (and http://3v4l.org/GeU1o#v510 tells me the same). ------------------------------------------------------------------------ [2013-11-13 11:21:38] machine dot check dot exception at gmail dot com 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. ------------------------------------------------------------------------ [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

« previous php.bugs (#182732) next »