Bug #69108 [Com]: "Segmentation fault" when (de)serializing SplObjectStorage

From: Date: Mon, 12 Apr 2021 15:51:47 +0000
Subject: Bug #69108 [Com]: "Segmentation fault" when (de)serializing SplObjectStorage
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233370@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69108&edit=1

 ID:                 69108
 Comment by:         eric dot quimby at rambler dot ru
 Reported by:        jan dot slabon at setasign dot com
 Summary:            "Segmentation fault" when (de)serializing
                     SplObjectStorage
 Status:             Closed
 Type:               Bug
 Package:            Reproducible crash
 Operating System:   Gentoo + Windows 7 + others
 PHP Version:        5.6.6
 Block user comment: N
 Private report:     N

 New Comment:

With the fact that the planning of spending on optimization of technologies according to the latest
trends may be expensive, it is worth providing the possibility of phased optimization in the future,
in the initial stages to have reasonable costs. Adaptive design https://777spinslot.com/free-bingo-no-deposit-no-card-details/
can serve as an example for a long time I watch their evolution


Previous Comments:
------------------------------------------------------------------------
[2015-02-25 10:24:04] laruence@php.net

Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ffdc5728c8d0c1cc31e2a13d1d7a03e85a85e7f0
Log: Fixed bug #69108 ("Segmentation fault" when (de)serializing SplObjectStorage)

------------------------------------------------------------------------
[2015-02-23 14:43:11] jan dot slabon at setasign dot com

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 this bug report at https://bugs.php.net/bug.php?id=69108&edit=1


Thread (3 messages)

« previous php.bugs (#233370) next »