summaryrefslogtreecommitdiff
path: root/Zend/zend_inheritance.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-11-03 14:49:10 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-11-03 14:49:10 +0100
commit7e5531755812a46841fc24ade5f71aefde69cf96 (patch)
tree326ac7ef23d33dbac0eec634b9556436729678b4 /Zend/zend_inheritance.c
parentee934f8245b58e1a557ed7b3f303f2d9d7cd23a6 (diff)
downloadphp-git-7e5531755812a46841fc24ade5f71aefde69cf96.tar.gz
Allow unlinked classes when performing in_compilation variance check
As preloading runs in in_compilation mode, we also need to allow use of unlinked classes in lookup_class().
Diffstat (limited to 'Zend/zend_inheritance.c')
-rw-r--r--Zend/zend_inheritance.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index 34489938a9..c3aad9f614 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -239,10 +239,9 @@ static zend_bool class_visible(zend_class_entry *ce) {
static zend_class_entry *lookup_class(
zend_class_entry *scope, zend_string *name, zend_bool register_unresolved) {
- zend_class_entry *ce;
+ uint32_t flags = ZEND_FETCH_CLASS_ALLOW_UNLINKED | ZEND_FETCH_CLASS_NO_AUTOLOAD;
+ zend_class_entry *ce = zend_lookup_class_ex(name, NULL, flags);
if (!CG(in_compilation)) {
- uint32_t flags = ZEND_FETCH_CLASS_ALLOW_UNLINKED | ZEND_FETCH_CLASS_NO_AUTOLOAD;
- ce = zend_lookup_class_ex(name, NULL, flags);
if (ce) {
return ce;
}
@@ -256,7 +255,6 @@ static zend_class_entry *lookup_class(
zend_hash_add_empty_element(CG(delayed_autoloads), name);
}
} else {
- ce = zend_lookup_class_ex(name, NULL, ZEND_FETCH_CLASS_NO_AUTOLOAD);
if (ce && class_visible(ce)) {
return ce;
}