]> granicus.if.org Git - php/commitdiff
Makrk persistent resources and references with GC_PERSISTENT flag
authorDmitry Stogov <dmitry@zend.com>
Fri, 27 Oct 2017 11:42:06 +0000 (14:42 +0300)
committerDmitry Stogov <dmitry@zend.com>
Fri, 27 Oct 2017 11:42:06 +0000 (14:42 +0300)
Zend/zend_types.h

index 4f073d47194122fba428e45dcecf392f1d84a7bd..159fc0f81d20e8681091208a9c608e216665a53e 100644 (file)
@@ -766,7 +766,8 @@ static zend_always_inline zend_uchar zval_get_type(const zval* pz) {
                (zend_resource *) malloc(sizeof(zend_resource));                \
                zval *__z;                                                                                              \
                GC_REFCOUNT(_res) = 1;                                                                  \
-               GC_TYPE_INFO(_res) = IS_RESOURCE;                                               \
+               GC_TYPE_INFO(_res) = IS_RESOURCE |                                              \
+                       (GC_PERSISTENT << GC_FLAGS_SHIFT);                                      \
                _res->handle = (h);                                                                             \
                _res->type = (t);                                                                               \
                _res->ptr = (p);                                                                                \
@@ -804,7 +805,8 @@ static zend_always_inline zend_uchar zval_get_type(const zval* pz) {
                zend_reference *_ref =                                                                  \
                (zend_reference *) malloc(sizeof(zend_reference));              \
                GC_REFCOUNT(_ref) = 1;                                                                  \
-               GC_TYPE_INFO(_ref) = IS_REFERENCE;                                              \
+               GC_TYPE_INFO(_ref) = IS_REFERENCE |                                             \
+                       (GC_PERSISTENT << GC_FLAGS_SHIFT);                                      \
                ZVAL_COPY_VALUE(&_ref->val, r);                                                 \
                Z_REF_P(z) = _ref;                                                                              \
                Z_TYPE_INFO_P(z) = IS_REFERENCE_EX;                                             \