From 67318e91bc9160910cf408be53e5eedbb05006d0 Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Fri, 11 Oct 2024 23:48:33 +0200 Subject: [PATCH] Fix op2 caching for static properties op2.num may contain other flags, like ZEND_FETCH_CLASS_EXCEPTION. These currently circumvent caching. Once the property is cached, these flags have no influence on the result, so it doesn't seem like this was done on purpose. Closes GH-16380 --- Zend/zend_execute.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 64422ddea89..e425e6625e4 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -3615,8 +3615,8 @@ static zend_always_inline zend_result zend_fetch_static_property_address(zval ** if (opline->op1_type == IS_CONST && (opline->op2_type == IS_CONST || (opline->op2_type == IS_UNUSED - && (opline->op2.num == ZEND_FETCH_CLASS_SELF - || opline->op2.num == ZEND_FETCH_CLASS_PARENT))) + && ((opline->op2.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_SELF + || (opline->op2.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT))) && EXPECTED(CACHED_PTR(cache_slot) != NULL)) { *retval = CACHED_PTR(cache_slot + sizeof(void *)); property_info = CACHED_PTR(cache_slot + sizeof(void *) * 2);