com php-src: Fix segfault when no class ctx is defined: Zend/zend_compile.c
| From: | Bob Weinand | Date: | Sat, 24 Jan 2015 19:00:46 +0000 |
| Subject: | com php-src: Fix segfault when no class ctx is defined: Zend/zend_compile.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-84356@lists.php.net to get a copy of this message | ||
Commit: c637ba118e4a42e5710b7beaf18ae79f4878ed5c
Author: Bob Weinand <bobwei9@hotmail.com> Sat, 24 Jan 2015 20:00:46 +0100
Parents: 8dc1287739cd5539a74f950c3c4813461e1de05d
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c637ba118e4a42e5710b7beaf18ae79f4878ed5c
Log:
Fix segfault when no class ctx is defined
Changed paths:
M Zend/zend_compile.c
Diff:
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 9e43fdf..bc11453 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -5731,15 +5731,14 @@ void zend_compile_class_const(znode *result, zend_ast *ast) /* {{{ */
zend_compile_expr(&const_node, const_ast);
- if (class_op && const_node.op_type == IS_CONST && class_op->extended_value ==
ZEND_FETCH_CLASS_SELF && Z_TYPE(const_node.u.constant) == IS_STRING) {
+ if (class_op && const_node.op_type == IS_CONST && class_op->extended_value ==
ZEND_FETCH_CLASS_SELF && Z_TYPE(const_node.u.constant) == IS_STRING &&
CG(active_class_entry)) {
zval *const_zv = zend_hash_find(&CG(active_class_entry)->constants_table,
Z_STR(const_node.u.constant));
if (const_zv && Z_TYPE_P(const_zv) < IS_CONSTANT) {
CG(active_op_array)->last--;
CG(active_op_array)->T--;
result->op_type = IS_CONST;
- Z_TRY_ADDREF_P(const_zv);
- result->u.constant = *const_zv;
+ ZVAL_COPY(&result->u.constant, const_zv);
zend_string_release(Z_STR(const_node.u.constant));
return;