com php-src: Merge branch 'master' into phpng: Zend/zend_ast .c ext/reflection/php_reflection.c
| From: | Dmitry Stogov | Date: | Wed, 23 Jul 2014 21:54:21 +0000 |
| Subject: | com php-src: Merge branch 'master' into phpng: Zend/zend_ast .c ext/reflection/php_reflection.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-79574@lists.php.net to get a copy of this message | ||
Commit: 7c6477ce37974f5d41cbbf245c27a2d0e6df1f6a
Author: Dmitry Stogov <dmitry@zend.com> Thu, 24 Jul 2014 01:54:21 +0400
Parents: 9583a14e7586a78b3756996e67c9590989a691f2 8fb7c4dc08c9d4eeb891be47b63b5b717bb61c45
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7c6477ce37974f5d41cbbf245c27a2d0e6df1f6a
Log:
Merge branch 'master' into phpng
* master:
Removed second zval_copy_ctor()
Fixed crash on self-referencing constant expression (part of a constant AST)
Fixed support for constant arrays in context of "const" statement
(Zend/tests/constant_expressions_arrays.phpt failed when opcache.protect_memort was set)
Conflicts:
Zend/zend_ast.c
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
ext/reflection/php_reflection..c
Changed paths:
MM Zend/zend_ast.c
MM ext/reflection/php_reflection.c
Diff:
diff --cc Zend/zend_ast.c
index e173afd,54448ac..824c0d5
--- a/Zend/zend_ast.c
+++ b/Zend/zend_ast.c
@@@ -282,9 -251,19 +282,17 @@@ ZEND_API void zend_ast_evaluate(zval *r
zval_dtor(&op2);
break;
case ZEND_CONST:
- ZVAL_DUP(result, &ast->u.val);
- if (Z_OPT_CONSTANT_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))) {
++ if (Z_OPT_CONSTANT(ast->u.val)) {
+ zval_update_constant_ex(&ast->u.val, 1, scope TSRMLS_CC);
+ }
- *result = *ast->u.val;
- zval_copy_ctor(result);
++ ZVAL_DUP(result, &ast->u.val);
+ } 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);
++ ZVAL_DUP(result, &ast->u.val);
++ if (Z_OPT_CONSTANT_P(result)) {
++ zval_update_constant_ex(result, 1, scope TSRMLS_CC);
+ }
}
break;
case ZEND_BOOL_AND:
diff --cc ext/reflection/php_reflection.c
index 7247542,02a19c0..f2d3059
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@@ -721,20 -726,31 +721,25 @@@ static void _parameter_string(string *s
if (fptr->type == ZEND_USER_FUNCTION && offset >= required) {
zend_op *precv = _get_recv_op((zend_op_array*)fptr, offset);
if (precv && precv->opcode == ZEND_RECV_INIT && precv->op2_type !=
IS_UNUSED) {
- zval *zv, zv_copy;
- int use_copy;
+ zval zv;
+ zend_class_entry *old_scope;
+
string_write(str, " = ", sizeof(" = ")-1);
- ALLOC_ZVAL(zv);
- *zv = *precv->op2.zv;
- zval_copy_ctor(zv);
- INIT_PZVAL(zv);
+ ZVAL_DUP(&zv, precv->op2.zv);
- zval_update_constant_ex(&zv, 1, fptr->common.scope TSRMLS_CC);
+ old_scope = EG(scope);
+ EG(scope) = fptr->common.scope;
+ zval_update_constant_ex(&zv, 1, NULL TSRMLS_CC);
+ EG(scope) = old_scope;
- if (Z_TYPE_P(zv) == IS_BOOL) {
- if (Z_LVAL_P(zv)) {
- string_write(str, "true", sizeof("true")-1);
- } else {
- string_write(str, "false", sizeof("false")-1);
- }
- } else if (Z_TYPE_P(zv) == IS_NULL) {
+ if (Z_TYPE(zv) == IS_TRUE) {
+ string_write(str, "true", sizeof("true")-1);
+ } else if (Z_TYPE(zv) == IS_FALSE) {
+ string_write(str, "false", sizeof("false")-1);
+ } else if (Z_TYPE(zv) == IS_NULL) {
string_write(str, "NULL", sizeof("NULL")-1);
- } else if (Z_TYPE_P(zv) == IS_STRING) {
+ } else if (Z_TYPE(zv) == IS_STRING) {
string_write(str, "'", sizeof("'")-1);
- string_write(str, Z_STRVAL_P(zv), MIN(Z_STRLEN_P(zv), 15));
- if (Z_STRLEN_P(zv) > 15) {
+ string_write(str, Z_STRVAL(zv), MIN(Z_STRLEN(zv), 15));
+ if (Z_STRLEN(zv) > 15) {
string_write(str, "...", sizeof("...")-1);
}
string_write(str, "'", sizeof("'")-1);
@@@ -2576,12 -2600,15 +2581,16 @@@ ZEND_METHOD(reflection_parameter, getDe
return;
}
- *return_value = *precv->op2.zv;
- INIT_PZVAL(return_value);
- if (!IS_CONSTANT_TYPE(Z_TYPE_P(return_value))) {
+ ZVAL_COPY_VALUE(return_value, precv->op2.zv);
+ if (Z_CONSTANT_P(return_value)) {
- zval_update_constant_ex(return_value, 0, param->fptr->common.scope TSRMLS_CC);
++ zend_class_entry *old_scope = EG(scope);
++
++ EG(scope) = param->fptr->common.scope;
++ zval_update_constant_ex(return_value, 0, NULL TSRMLS_CC);
++ EG(scope) = old_scope;
+ } else {
zval_copy_ctor(return_value);
}
- old_scope = EG(scope);
- EG(scope) = param->fptr->common.scope;
- zval_update_constant_ex(&return_value, 0, NULL TSRMLS_CC);
- EG(scope) = old_scope;
}
/* }}} */