From 3ad0e1d6ca7d9cfed58282df0d082a6ddbf14574 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 8 Apr 2016 01:48:21 +0200 Subject: [PATCH] Fix static method arg binding in traits --- Zend/tests/traits/no_static_arg_binding.phpt | 28 ++++++++++++++++++++ ext/opcache/Optimizer/optimize_func_calls.c | 1 + 2 files changed, 29 insertions(+) create mode 100644 Zend/tests/traits/no_static_arg_binding.phpt diff --git a/Zend/tests/traits/no_static_arg_binding.phpt b/Zend/tests/traits/no_static_arg_binding.phpt new file mode 100644 index 00000000000..3134cf621b4 --- /dev/null +++ b/Zend/tests/traits/no_static_arg_binding.phpt @@ -0,0 +1,28 @@ +--TEST-- +Don't statically bind arguments for self:: calls in traits +--FILE-- + +--EXPECT-- +int(1) diff --git a/ext/opcache/Optimizer/optimize_func_calls.c b/ext/opcache/Optimizer/optimize_func_calls.c index 5982df5f516..8af82e41379 100644 --- a/ext/opcache/Optimizer/optimize_func_calls.c +++ b/ext/opcache/Optimizer/optimize_func_calls.c @@ -77,6 +77,7 @@ void zend_optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx) zend_string *class_name = Z_STR_P(&ZEND_OP1_LITERAL(opline) + 1); ce = zend_hash_find_ptr(&ctx->script->class_table, class_name); } else if (opline->op1_type == IS_UNUSED && op_array->scope + && !(op_array->scope->ce_flags & ZEND_ACC_TRAIT) && (opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_SELF) { ce = op_array->scope; }