diff options
| author | Dmitry Stogov <dmitry@zend.com> | 2014-07-24 00:37:15 +0400 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@zend.com> | 2014-07-24 00:37:15 +0400 |
| commit | d909b6330e314bb434350317fda5bec185ea12c0 (patch) | |
| tree | b35001e95a43f68204b3b8e9c861123523202c4e /Zend/zend_ast.c | |
| parent | c49a06168ed3759779452e2b2a44da22e75a0702 (diff) | |
| download | php-git-d909b6330e314bb434350317fda5bec185ea12c0.tar.gz | |
Fixed crash on self-referencing constant expression (part of a constant AST)
Diffstat (limited to 'Zend/zend_ast.c')
| -rw-r--r-- | Zend/zend_ast.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 12f9405523..a7df0adbab 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -251,10 +251,19 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s zval_dtor(&op2); break; case ZEND_CONST: - *result = *ast->u.val; - zval_copy_ctor(result); - if (IS_CONSTANT_TYPE(Z_TYPE_P(result))) { - zval_update_constant_ex(&result, 1, scope TSRMLS_CC); + /* class constants may be updated in-place */ + if (scope) { + if (IS_CONSTANT_TYPE(Z_TYPE_P(ast->u.val))) { + zval_update_constant_ex(&ast->u.val, 1, scope TSRMLS_CC); + } + *result = *ast->u.val; + zval_copy_ctor(result); + } else { + *result = *ast->u.val; + zval_copy_ctor(result); + if (IS_CONSTANT_TYPE(Z_TYPE_P(result))) { + zval_update_constant_ex(&result, 1, scope TSRMLS_CC); + } } break; case ZEND_BOOL_AND: |
