Bug #69108 [NEW]: "Segmentation fault" when (de)serializing SplObjectStorage
From: jan dot slabon at setasign dot com
Operating system: Gentoo + Windows 7 + others
PHP version: 5.6.6
Package: Reproducible crash
Bug Type: Bug
Bug description:"Segmentation fault" when (de)serializing SplObjectStorage
Description:
------------
We encountered a problem in one of our applications which ended in a
segmentation fault/zend_mm_heap corrupted errors in our log files.
We tracked it down to an issue with serializing/deserializing
SplObjectStorage objects and the garbadge collector. The test script
make use of thousands of objects but in our application we used only
some hands full of objects. Sadly we were not able to extract these
logic into a smal code but the following test script should show the
same behaviour.
We could reproduce the error in several PHP versions (since 5.4) and
also run it on http://3v4l.org/tUoUf which showed the same
problem for
PHP 5.4.0 up to 5.6.6.
After all the segmentation fault does not arise if we disable the
garbage collector with gc_disable().
Test script:
---------------
<?php
// gc_disable(); // <-- if this comment is removed, everything works as
expected
$a = array();
$b = new SplObjectStorage();
for ($i = 10000; $i > 0; $i--) {
$object = new StdClass();
$a[] = $object;
$b->attach($object);
}
$c = serialize(array($a, $b));
$d = unserialize($c);
echo "ok";
Expected result:
----------------
ok
Actual result:
--------------
See http://3v4l.org/tUoUf
--
Edit bug report at https://bugs.php.net/bug.php?id=69108&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69108&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69108&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69108&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69108&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69108&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69108&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69108&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69108&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69108&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69108&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69108&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69108&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69108&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69108&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69108&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69108&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69108&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69108&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69108&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69108&r=mysqlcfg
Thread (3 messages)
- jan dot slabon at setasign dot com