diff options
author | Xinchen Hui <laruence@gmail.com> | 2019-12-24 14:20:55 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@gmail.com> | 2019-12-24 14:20:55 +0800 |
commit | f09b958e90afc0458a30a2c775abc2525827e7ac (patch) | |
tree | b3320d4ca08d7b89c88ebe19d3ad456901169a22 | |
parent | 153c9cc346bae927394d3ce1378f77fb7c1e1be3 (diff) | |
download | php-git-f09b958e90afc0458a30a2c775abc2525827e7ac.tar.gz |
Similar problem (#79022) also exists in Interfaces
-rw-r--r-- | Zend/tests/bug79022.phpt | 17 | ||||
-rw-r--r-- | Zend/zend_builtin_functions.c | 4 |
2 files changed, 19 insertions, 2 deletions
diff --git a/Zend/tests/bug79022.phpt b/Zend/tests/bug79022.phpt index 252effdb31..0657b20355 100644 --- a/Zend/tests/bug79022.phpt +++ b/Zend/tests/bug79022.phpt @@ -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-- diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index f4733d7b1f..266b50599b 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -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; } @@ -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); } /* }}} */ |