summaryrefslogtreecommitdiff
path: root/Zend/zend_object_handlers.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2019-08-08 10:07:39 +0300
committerDmitry Stogov <dmitry@zend.com>2019-08-08 10:07:39 +0300
commit720438c8eeb174bcf9ed5ad815c0e511f179679d (patch)
tree455e02cded93a134a061eeeb55d5916f2228cceb /Zend/zend_object_handlers.c
parentbe794894ef30764e54a8a52fa6c085f3c4a88b14 (diff)
parentbff2743caf93332dd4a2ca658f50dc3c1d8cb144 (diff)
downloadphp-git-720438c8eeb174bcf9ed5ad815c0e511f179679d.tar.gz
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fixed bug #78379 (Cast to object confuses GC, causes crash)
Diffstat (limited to 'Zend/zend_object_handlers.c')
-rw-r--r--Zend/zend_object_handlers.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index 3f8be6f707..65aefb6aec 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -127,6 +127,11 @@ ZEND_API HashTable *zend_std_get_gc(zval *object, zval **table, int *n) /* {{{ *
if (zobj->properties) {
*table = NULL;
*n = 0;
+ if (UNEXPECTED(GC_REFCOUNT(zobj->properties) > 1)
+ && EXPECTED(!(GC_FLAGS(zobj->properties) & IS_ARRAY_IMMUTABLE))) {
+ GC_DELREF(zobj->properties);
+ zobj->properties = zend_array_dup(zobj->properties);
+ }
return zobj->properties;
} else {
*table = zobj->properties_table;