diff options
author | Xinchen Hui <laruence@gmail.com> | 2015-10-03 20:14:55 -0700 |
---|---|---|
committer | Xinchen Hui <laruence@gmail.com> | 2015-10-03 20:15:35 -0700 |
commit | 6876112c89e6dc4434e64a78084ca3bb118c98bd (patch) | |
tree | e0c68a4dfcf471988c0f6f1b1c4a599b03b6e426 /ext/reflection | |
parent | 4744eec753786e18b28887463bdcb3f1e91efb60 (diff) | |
download | php-git-6876112c89e6dc4434e64a78084ca3bb118c98bd.tar.gz |
Fixed the third one of (segfault in gc_remove_from_buffer())
This one maybe only used in debug mode, so no bug report and no test
script provided
Diffstat (limited to 'ext/reflection')
-rw-r--r-- | ext/reflection/php_reflection.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 3bf49eafc7..e1a2c57668 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -750,14 +750,18 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg zend_class_entry *old_scope; string_write(str, " = ", sizeof(" = ")-1); - ALLOC_ZVAL(zv); - *zv = *precv->op2.zv; - zval_copy_ctor(zv); - INIT_PZVAL(zv); - old_scope = EG(scope); - EG(scope) = fptr->common.scope; - zval_update_constant_ex(&zv, 1, NULL TSRMLS_CC); - EG(scope) = old_scope; + if (IS_CONSTANT_TYPE(Z_TYPE_P(precv->op2.zv))) { + ALLOC_ZVAL(zv); + *zv = *precv->op2.zv; + zval_copy_ctor(zv); + INIT_PZVAL(zv); + old_scope = EG(scope); + EG(scope) = fptr->common.scope; + zval_update_constant_ex(&zv, 1, NULL TSRMLS_CC); + EG(scope) = old_scope; + } else { + zv = precv->op2.zv; + } if (Z_TYPE_P(zv) == IS_BOOL) { if (Z_LVAL_P(zv)) { string_write(str, "true", sizeof("true")-1); @@ -782,7 +786,9 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg zval_dtor(&zv_copy); } } - zval_ptr_dtor(&zv); + if (zv != precv->op2.zv) { + zval_ptr_dtor(&zv); + } } } string_write(str, " ]", sizeof(" ]")-1); |