Similar problem (#79022) also exists in Interfaces

This commit is contained in:
Xinchen Hui 2019-12-24 14:20:55 +08:00
parent 153c9cc346
commit f09b958e90
2 changed files with 19 additions and 2 deletions

View file

@ -13,9 +13,26 @@ function my_autoloader($class) {
if ($class == 'Bar') { if ($class == 'Bar') {
eval("class Bar {}"); eval("class Bar {}");
} }
if ($class == 'Dummy') {
eval ("class Dummy implements iFoo {}");
}
if (interface_exists('iFoo', 0)) {
new Dummy();
}
if ($class == 'iFoo') {
eval ("interface iFoo extends iBar {}");
}
if ($class == 'iBar') {
eval ("interface iBar {}");
}
} }
spl_autoload_register('my_autoloader'); spl_autoload_register('my_autoloader');
new Foo(); new Foo();
new Dummy();
echo "okey"; echo "okey";
?> ?>
--EXPECT-- --EXPECT--

View file

@ -1476,7 +1476,7 @@ static inline void class_exists_impl(INTERNAL_FUNCTION_PARAMETERS, int flags, in
} }
if (ce) { if (ce) {
RETURN_BOOL((flags == 0 || (ce->ce_flags & flags)) && !(ce->ce_flags & skip_flags)); RETURN_BOOL(((ce->ce_flags & flags) == flags) && !(ce->ce_flags & skip_flags));
} else { } else {
RETURN_FALSE; RETURN_FALSE;
} }
@ -1495,7 +1495,7 @@ ZEND_FUNCTION(class_exists)
Checks if the class exists */ Checks if the class exists */
ZEND_FUNCTION(interface_exists) ZEND_FUNCTION(interface_exists)
{ {
class_exists_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_INTERFACE, 0); class_exists_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_LINKED|ZEND_ACC_INTERFACE, 0);
} }
/* }}} */ /* }}} */