com php-src: Fixed bug #69108 ("Segmentation fault" when (de)serializing SplObjectStorage): NEWS ext/spl/spl_observer.c ext/spl/te sts/bug69108.phpt

From: Date: Wed, 25 Feb 2015 10:21:59 +0000
Subject: com php-src: Fixed bug #69108 ("Segmentation fault" when (de)serializing SplObjectStorage): NEWS ext/spl/spl_observer.c ext/spl/te sts/bug69108.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-85079@lists.php.net to get a copy of this message
Commit: ffdc5728c8d0c1cc31e2a13d1d7a03e85a85e7f0 Author: Xinchen Hui <laruence@php.net> Wed, 25 Feb 2015 18:21:59 +0800 Parents: 1bfbb546f761266a769a3f1f85c26802cc7996a1 Branches: PHP-5.5 PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ffdc5728c8d0c1cc31e2a13d1d7a03e85a85e7f0 Log: Fixed bug #69108 ("Segmentation fault" when (de)serializing SplObjectStorage) Bugs: https://bugs.php.net/69108 Changed paths: M NEWS M ext/spl/spl_observer.c A ext/spl/tests/bug69108.phpt Diff: diff --git a/NEWS b/NEWS index ef42a5e..f8d653f 100644 --- a/NEWS +++ b/NEWS @@ -36,6 +36,8 @@ PHP NEWS parameters). (Laruence) - SPL: + . Fixed bug #69108 ("Segmentation fault" when (de)serializing + SplObjectStorage). (Laruence) . Fixed bug #68557 (RecursiveDirectoryIterator::seek(0) broken after calling getChildren()). (Julien) diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index a7f6132..5e21088 100644 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -782,6 +782,7 @@ SPL_METHOD(SplObjectStorage, serialize) INIT_PZVAL(&members); Z_ARRVAL(members) = zend_std_get_properties(getThis() TSRMLS_CC); Z_TYPE(members) = IS_ARRAY; + zend_hash_del(Z_ARRVAL(members), "\x00gcdata", sizeof("\x00gcdata")); pmembers = &members; php_var_serialize(&buf, &pmembers, &var_hash TSRMLS_CC); /* finishes the string */ diff --git a/ext/spl/tests/bug69108.phpt b/ext/spl/tests/bug69108.phpt new file mode 100644 index 0000000..1829e9b --- /dev/null +++ b/ext/spl/tests/bug69108.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #69108 ("Segmentation fault" when (de)serializing SplObjectStorage) +--INI-- +zend.enable_gc=1 +--FILE-- +<?php +$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); + +unset($d); +echo "ok"; +?> +--EXPECT-- +ok

« previous php.cvs (#85079) next »