Skip to content

Commit f09b958

Browse files
committed
Similar problem (#79022) also exists in Interfaces
1 parent 153c9cc commit f09b958

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

Zend/tests/bug79022.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,26 @@ function my_autoloader($class) {
1313
if ($class == 'Bar') {
1414
eval("class Bar {}");
1515
}
16+
17+
if ($class == 'Dummy') {
18+
eval ("class Dummy implements iFoo {}");
19+
}
20+
21+
22+
if (interface_exists('iFoo', 0)) {
23+
new Dummy();
24+
}
25+
if ($class == 'iFoo') {
26+
eval ("interface iFoo extends iBar {}");
27+
}
28+
29+
if ($class == 'iBar') {
30+
eval ("interface iBar {}");
31+
}
1632
}
1733
spl_autoload_register('my_autoloader');
1834
new Foo();
35+
new Dummy();
1936
echo "okey";
2037
?>
2138
--EXPECT--

Zend/zend_builtin_functions.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,7 +1476,7 @@ static inline void class_exists_impl(INTERNAL_FUNCTION_PARAMETERS, int flags, in
14761476
}
14771477

14781478
if (ce) {
1479-
RETURN_BOOL((flags == 0 || (ce->ce_flags & flags)) && !(ce->ce_flags & skip_flags));
1479+
RETURN_BOOL(((ce->ce_flags & flags) == flags) && !(ce->ce_flags & skip_flags));
14801480
} else {
14811481
RETURN_FALSE;
14821482
}
@@ -1495,7 +1495,7 @@ ZEND_FUNCTION(class_exists)
14951495
Checks if the class exists */
14961496
ZEND_FUNCTION(interface_exists)
14971497
{
1498-
class_exists_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_INTERFACE, 0);
1498+
class_exists_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_LINKED|ZEND_ACC_INTERFACE, 0);
14991499
}
15001500
/* }}} */
15011501

0 commit comments

Comments
 (0)