com php-src: Fix passed zval reassignments (opcache.protect _memory=1): Zend/zend_object_handlers.c

From: Date: Tue, 24 May 2016 10:51:02 +0000
Subject: com php-src: Fix passed zval reassignments (opcache.protect _memory=1): Zend/zend_object_handlers.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-95548@lists.php.net to get a copy of this message
Commit: 758076ab0c6e789b2ae54ae486edf421ca83ab25 Author: Bob Weinand <bobwei9@hotmail.com> Tue, 24 May 2016 12:42:13 +0200 Parents: 25ed1f257eafcf11e96222aaf2acc21165f8f259 Branches: typed_ref_properties Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=758076ab0c6e789b2ae54ae486edf421ca83ab25 Log: Fix passed zval reassignments (opcache.protect_memory=1) Changed paths: M Zend/zend_object_handlers.c Diff: diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index a55e54e..a7c1414 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -758,8 +758,13 @@ ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, v } if ((variable_ptr = zend_hash_find(zobj->properties, Z_STR_P(member))) != NULL) { zend_property_info *prop_info; + zval val; found: if (UNEXPECTED(prop_info = zend_object_fetch_property_type_info_ex(object, Z_STR_P(member), cache_slot))) { + if (!Z_REFCOUNTED_P(value) || Z_REFCOUNT_P(value) > 1) { + ZVAL_COPY_VALUE(&val, value); + value = &val; + } if (!zend_verify_property_type(prop_info, value, ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data)))) { zend_verify_property_type_error(prop_info, Z_STR_P(member), value); goto exit; @@ -816,7 +821,12 @@ write_std_property: if (EXPECTED(property_offset != ZEND_DYNAMIC_PROPERTY_OFFSET)) { zend_property_info *prop_info; + zval val; if (cache_slot ? UNEXPECTED(prop_info = (zend_property_info *) CACHED_PTR_EX(cache_slot + 2)) : UNEXPECTED(prop_info = zend_object_fetch_property_type_info_ex(object, Z_STR_P(member), NULL))) { + if (!Z_REFCOUNTED_P(value) || Z_REFCOUNT_P(value) > 1) { + ZVAL_COPY_VALUE(&val, value); + value = &val; + } if (!zend_verify_property_type(prop_info, value, ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data)))) { zend_verify_property_type_error(prop_info, Z_STR_P(member), value); goto exit;

« previous php.cvs (#95548) next »