From b867bd1c8d00701c0952fca4ea5ef9af39f9bb07 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 26 Mar 2016 22:43:58 +0100 Subject: [PATCH] Fix FETCH_CLASS_SELF comparisons Turns out those don't form a bitfield. --- Zend/zend_compile.c | 3 ++- ext/opcache/Optimizer/optimize_func_calls.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 521cd08f36..64e0e0d1e3 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3738,7 +3738,8 @@ void zend_compile_static_call(znode *result, zend_ast *ast, uint32_t type) /* {{ && zend_string_equals_ci(CG(active_class_entry)->name, lcname)) { ce = CG(active_class_entry); } - } else if (opline->op1_type == IS_UNUSED && (opline->op1.num & ZEND_FETCH_CLASS_SELF) + } else if (opline->op1_type == IS_UNUSED + && (opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_SELF && zend_is_scope_known()) { ce = CG(active_class_entry); } diff --git a/ext/opcache/Optimizer/optimize_func_calls.c b/ext/opcache/Optimizer/optimize_func_calls.c index 22829ad20d..5982df5f51 100644 --- a/ext/opcache/Optimizer/optimize_func_calls.c +++ b/ext/opcache/Optimizer/optimize_func_calls.c @@ -77,7 +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 - && (opline->op1.num & ZEND_FETCH_CLASS_SELF)) { + && (opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_SELF) { ce = op_array->scope; } if (ce) { -- 2.40.0