|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69108 "Segmentation fault" when (de)serializing SplObjectStorage
Submitted: 2015-02-23 14:43 UTC Modified: -
From: jan dot slabon at setasign dot com Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 5.6.6 OS: Gentoo + Windows 7 + others
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: jan dot slabon at setasign dot com
New email:
PHP Version: OS:


 [2015-02-23 14:43 UTC] jan dot slabon at setasign dot com
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 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:
// 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;

$c = serialize(array($a, $b));
$d = unserialize($c);

echo "ok";

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-02-25 10:24 UTC]
Automatic comment on behalf of laruence
Log: Fixed bug #69108 (&quot;Segmentation fault&quot; when (de)serializing SplObjectStorage)
 [2015-02-25 10:24 UTC]
-Status: Open +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 27 10:01:30 2024 UTC