From: Operating system: Ubuntu Linux 10.10 x64 PHP version: 5.3.6 Package: Reproducible crash Bug Type: Bug Bug description:Segmentation fault with Serializable Object on self-reference
Description: ------------ --- >From manual page: http://www.php.net/class.serializable --- When a Serializable object contains a reference to it self a Segmentation fault is caused. I first encountered this in 5.3.3, then found a binary package for 5.3.5 for my distribution. Finally I compiled my own 5.3.6. The segmentation fault persists in all three versions. If the Serializable interface is removed the code works fine. Although the fault is reproducible, I found encountered other self-reference scenarios where it is not triggered, making this very unpredictable. Test script: --------------- class Test implements Serializable { public $member, $message; function __construct($message) { $this->message = $message; } function serialize() { return serialize(array($this->message, $this->member)); } function unserialize($serialized) { list($this->message, $this->member) = unserialize($serialized); } } $constructed = new Test("original"); $constructed->member = $constructed; //References to self (in this example pointless, but technically legal) var_dump($constructed); $transported = unserialize(serialize($constructed)); // Segmentation fault. Expected result: ---------------- Clean exit.. Actual result: -------------- object(Test)#1 (2) { ["member"]=> *RECURSION* ["message"]=> string(8) "original" } Segmentation fault -- Edit bug report at https://bugs.php.net/bug.php?id=55219&edit=1 -- Try a snapshot (PHP 5.2): https://bugs.php.net/fix.php?id=55219&r=trysnapshot52 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55219&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55219&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=55219&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55219&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=55219&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=55219&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=55219&r=needscript Try newer version: https://bugs.php.net/fix.php?id=55219&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=55219&r=support Expected behavior: https://bugs.php.net/fix.php?id=55219&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=55219&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=55219&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=55219&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55219&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=55219&r=dst IIS Stability: https://bugs.php.net/fix.php?id=55219&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=55219&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=55219&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=55219&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=55219&r=mysqlcfg Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55219&r=trysnapshot54