com php-src: Fix bug #71838: NEWS ext/spl/spl_observer.c ext/spl/tests/bug71838.phpt

From: Date: Fri, 18 Mar 2016 18:58:52 +0000
Subject: com php-src: Fix bug #71838: NEWS ext/spl/spl_observer.c ext/spl/tests/bug71838.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-91419@lists.php.net to get a copy of this message
Commit: 094c80837440963872368e81188b58d7c7d214fa Author: Nikita Popov <nikic@php.net> Fri, 18 Mar 2016 19:58:52 +0100 Parents: fd955551070013464b4e909a79ab7e4b8abc90f7 Branches: PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=094c80837440963872368e81188b58d7c7d214fa Log: Fix bug #71838 Bugs: https://bugs.php.net/71838 Changed paths: M NEWS M ext/spl/spl_observer.c A ext/spl/tests/bug71838.phpt Diff: diff --git a/NEWS b/NEWS index ed5bab7..1005c3e 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,10 @@ PHP NEWS . Fixed bug #71820 (pg_fetch_object binds parameters before call constructor). (Anatol) +- SPL: + . Fixed bug #71838 (Deserializing serialized SPLObjectStorage-Object can't + access properties in PHP). (Nikita) + - Standard: . Fixed bug #71837 (Wrong arrays behaviour). (Laruence) . Fixed bug #71840 (Unserialize accepts wrongly data). (Ryat, Laruence) diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index e8d6074..76b98a5 100644 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -843,10 +843,7 @@ SPL_METHOD(SplObjectStorage, unserialize) } /* copy members */ - if (!intern->std.properties) { - rebuild_object_properties(&intern->std); - } - zend_hash_copy(intern->std.properties, Z_ARRVAL_P(pmembers), (copy_ctor_func_t) zval_add_ref); + object_properties_load(&intern->std, Z_ARRVAL_P(pmembers)); PHP_VAR_UNSERIALIZE_DESTROY(var_hash); return; diff --git a/ext/spl/tests/bug71838.phpt b/ext/spl/tests/bug71838.phpt new file mode 100644 index 0000000..44fc761 --- /dev/null +++ b/ext/spl/tests/bug71838.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #71839: Deserializing serialized SPLObjectStorage-Object can't access properties in PHP +--FILE-- +<?php + +class A extends SplObjectStorage { + protected $a = null; + + public function __construct() { + $this->a = '123'; + } + + public function getA() { + return $this->a; + } +} + +$serialized = serialize(new A()); +$obj = unserialize($serialized); +var_dump($obj->getA()); + +?> +--EXPECT-- +string(3) "123"

« previous php.cvs (#91419) next »