1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00

Improve static inference in final class (#13298)

static may be treated like self if the class is final.
This commit is contained in:
Ilija Tovilo
2024-02-01 11:49:08 +01:00
committed by GitHub
parent 2bf9f7eb19
commit 95f7335251

View File

@@ -821,7 +821,9 @@ zend_class_entry *zend_optimizer_get_class_entry_from_op1(
}
} 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) {
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_SELF
|| ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_STATIC
&& (op_array->scope->ce_flags & ZEND_ACC_FINAL)))) {
return op_array->scope;
}
return NULL;