@@ -199,16 +199,18 @@ static zend_bool class_visible(zend_class_entry *ce) {
199
199
static zend_class_entry * lookup_class (const zend_function * fe , zend_string * name ) {
200
200
zend_class_entry * ce ;
201
201
if (!CG (in_compilation )) {
202
- return zend_lookup_class (name );
203
- }
204
-
205
- ce = zend_lookup_class_ex (name , NULL , /* autoload */ 0 );
206
- if (ce && class_visible (ce )) {
207
- return ce ;
202
+ ce = zend_lookup_class (name );
203
+ if (ce ) {
204
+ return ce ;
205
+ }
206
+ } else {
207
+ ce = zend_lookup_class_ex (name , NULL , /* autoload */ 0 );
208
+ if (ce && class_visible (ce )) {
209
+ return ce ;
210
+ }
208
211
}
209
212
210
- /* When checking whether early binding is possible, the current class will not be registered
211
- * yet, so check for it explicitly. */
213
+ /* The current class may not be registered yet, so check for it explicitly. */
212
214
if (zend_string_equals_ci (fe -> common .scope -> name , name )) {
213
215
return fe -> common .scope ;
214
216
}
@@ -219,7 +221,7 @@ static zend_class_entry *lookup_class(const zend_function *fe, zend_string *name
219
221
/* Instanceof that's safe to use on unlinked classes. For the unlinked case, we only handle
220
222
* class identity here. */
221
223
static zend_bool unlinked_instanceof (zend_class_entry * ce1 , zend_class_entry * ce2 ) {
222
- if ((ce1 -> ce_flags & ZEND_ACC_LINKED ) && ( ce2 -> ce_flags & ZEND_ACC_LINKED )) {
224
+ if ((ce1 -> ce_flags & ( ZEND_ACC_LINKED | ZEND_ACC_LINKING_IN_PROGRESS ) )) {
223
225
return instanceof_function (ce1 , ce2 );
224
226
}
225
227
return ce1 == ce2 ;
0 commit comments