Skip to content

Commit

Permalink
Similar problem (#79022) also exists in Interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
laruence committed Dec 24, 2019
1 parent 153c9cc commit f09b958
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 17 additions & 0 deletions Zend/tests/bug79022.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,26 @@ function my_autoloader($class) {
if ($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');
new Foo();
new Dummy();
echo "okey";
?>
--EXPECT--
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_builtin_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,7 @@ static inline void class_exists_impl(INTERNAL_FUNCTION_PARAMETERS, int flags, in
}

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 {
RETURN_FALSE;
}
Expand All @@ -1495,7 +1495,7 @@ ZEND_FUNCTION(class_exists)
Checks if the class 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);
}
/* }}} */

Expand Down

0 comments on commit f09b958

Please sign in to comment.