summaryrefslogtreecommitdiff
path: root/Zend/zend_object_handlers.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2019-08-08 10:05:59 +0300
committerDmitry Stogov <dmitry@zend.com>2019-08-08 10:05:59 +0300
commitbff2743caf93332dd4a2ca658f50dc3c1d8cb144 (patch)
treee513c948c2d2560be027e92d72cbdd3357bd0f4a /Zend/zend_object_handlers.c
parent9ea39d15abef3df259e0aa2974d1c530654aa2b1 (diff)
parent358379be22c4e20f4942737e0e90422977355c63 (diff)
downloadphp-git-bff2743caf93332dd4a2ca658f50dc3c1d8cb144.tar.gz
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: 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 7d200402a9..266c257f79 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -124,6 +124,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;