Bug #69072 [NEW]: bug when serializing classes that implements Serializable interface
| From: | quamis+php at gmail dot com | Date: | Wed, 18 Feb 2015 11:18:13 +0000 |
| Subject: | Bug #69072 [NEW]: bug when serializing classes that implements Serializable interface | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-190782@lists.php.net to get a copy of this message | ||
From: quamis+php at gmail dot com
Operating system: Linux
PHP version: 5.6.5
Package: Class/Object related
Bug Type: Bug
Bug description:bug when serializing classes that implements Serializable interface
Description:
------------
Consider the following example:
class A implements Serializable, defines serialize() as a serialized
stdClass
class B extends A, adds 1 public member
index.php instantiates B and serializes it to be able to cache it/store
it for future reference.
function serialize fails in this case, returns an invalid string. It
should at least issue an exception/warning.
If class A defines serialize() as a serialized array it will work as
expected.
Test script:
---------------
Testcase: http://pastebin.com/6Hc60VbD , http://3v4l.org/SggeU
Working testcase (class A returns serialized array):
http://pastebin.com/itzZY1En , http://3v4l.org/hIJE9
Expected result:
----------------
no exception should be thrown, and an actual representation of the class
should be generated.
According to http://3v4l.org, this woked ok in PHP 5.3, and its
broken
since PHP 5.4
--
Edit bug report at https://bugs.php.net/bug.php?id=69072&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69072&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69072&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69072&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69072&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69072&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69072&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69072&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69072&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69072&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69072&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69072&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69072&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69072&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69072&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69072&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69072&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69072&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69072&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69072&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69072&r=mysqlcfg