diff options
author | Xinchen Hui <laruence@gmail.com> | 2015-09-02 22:07:29 -0700 |
---|---|---|
committer | Xinchen Hui <laruence@gmail.com> | 2015-09-02 22:07:29 -0700 |
commit | 6815c08e2939f49a2ac9087924d58448edb401ba (patch) | |
tree | dfa60563f186b80e0f1b284eb7fc76067c0d229e /Zend/zend_builtin_functions.c | |
parent | 6290344d96bc31a5c4f682ac5d94d9f30c01d4df (diff) | |
download | php-git-6815c08e2939f49a2ac9087924d58448edb401ba.tar.gz |
Fixed bug #70398 (SIGSEGV, Segmentation fault zend_ast_destroy_ex)
Diffstat (limited to 'Zend/zend_builtin_functions.c')
-rw-r--r-- | Zend/zend_builtin_functions.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index fc834dfa0e..818cc54dd0 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -780,6 +780,8 @@ static void copy_constant_array(zval *dst, zval *src) /* {{{ */ if (!Z_IMMUTABLE_P(val)) { copy_constant_array(new_val, val); } + } else if (Z_TYPE_INFO_P(val) == IS_RESOURCE_EX) { + Z_TYPE_INFO_P(new_val) &= ~(IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT); } else if (Z_REFCOUNTED_P(val)) { Z_ADDREF_P(val); } @@ -810,7 +812,7 @@ ZEND_FUNCTION(define) ZEND_PARSE_PARAMETERS_END(); #endif - if(non_cs) { + if (non_cs) { case_sensitive = 0; } @@ -829,9 +831,14 @@ repeat: case IS_STRING: case IS_FALSE: case IS_TRUE: - case IS_RESOURCE: case IS_NULL: break; + case IS_RESOURCE: + ZVAL_COPY(&val_free, val); + /* TODO: better solution than this tricky disable dtor on resource? */ + Z_TYPE_INFO(val_free) &= ~(IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT); + val = &val_free; + break; case IS_ARRAY: if (!Z_IMMUTABLE_P(val)) { if (!validate_constant_array(Z_ARRVAL_P(val))) { |