Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions Zend/zend_inheritance.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,22 +200,39 @@ static bool class_visible(zend_class_entry *ce) {
}
}

static zend_always_inline void register_unresolved_class(zend_string *name) {
/* We'll autoload this class and process delayed variance obligations later. */
if (!CG(delayed_autoloads)) {
ALLOC_HASHTABLE(CG(delayed_autoloads));
zend_hash_init(CG(delayed_autoloads), 0, NULL, NULL, 0);
}
zend_hash_add_empty_element(CG(delayed_autoloads), name);
}

static zend_class_entry *lookup_class(
zend_class_entry *scope, zend_string *name, bool register_unresolved) {
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 (UNEXPECTED(!EG(active))) {
if (zend_string_equals_ci(scope->name, name)) {
return scope;
}

if (register_unresolved) {
register_unresolved_class(name);
}

return NULL;
}

zend_class_entry *ce = zend_lookup_class_ex(
name, NULL, ZEND_FETCH_CLASS_ALLOW_UNLINKED | ZEND_FETCH_CLASS_NO_AUTOLOAD);

if (!CG(in_compilation)) {
if (ce) {
return ce;
}

if (register_unresolved) {
/* We'll autoload this class and process delayed variance obligations later. */
if (!CG(delayed_autoloads)) {
ALLOC_HASHTABLE(CG(delayed_autoloads));
zend_hash_init(CG(delayed_autoloads), 0, NULL, NULL, 0);
}
zend_hash_add_empty_element(CG(delayed_autoloads), name);
register_unresolved_class(name);
}
} else {
if (ce && class_visible(ce)) {
Expand Down
2 changes: 1 addition & 1 deletion ext/reflection/php_reflection.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ public function __toString(): string {}
public function getName() {}

/** @return mixed */
public function getValue() {}
public function getValue(): mixed {}

/** @return bool */
public function isPublic() {}
Expand Down
5 changes: 3 additions & 2 deletions ext/reflection/php_reflection_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 47ac64b027cdeb0e9996147277f79fa9d6b876bd */
* Stub hash: cef133f3196139e48f8ce1ada0994e538503856d */

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Reflection_getModifierNames, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, modifiers, IS_LONG, 0)
Expand Down Expand Up @@ -342,7 +342,8 @@ ZEND_END_ARG_INFO()

#define arginfo_class_ReflectionClassConstant_getName arginfo_class_ReflectionFunctionAbstract_inNamespace

#define arginfo_class_ReflectionClassConstant_getValue arginfo_class_ReflectionFunctionAbstract_inNamespace
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ReflectionClassConstant_getValue, 0, 0, IS_MIXED, 0)
ZEND_END_ARG_INFO()

#define arginfo_class_ReflectionClassConstant_isPublic arginfo_class_ReflectionFunctionAbstract_inNamespace

Expand Down