diff options
Diffstat (limited to 'Zend/zend_builtin_functions.c')
-rw-r--r-- | Zend/zend_builtin_functions.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index e3bc2ad101..d3bf032c10 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -1373,7 +1373,11 @@ ZEND_FUNCTION(method_exists) zend_string_release_ex(lcname, 0); if (func) { - RETURN_BOOL(!(func->common.fn_flags & ZEND_ACC_PRIVATE) || func->common.scope == ce); + /* Exclude shadow properties when checking a method on a specific class. Include + * them when checking an object, as method_exists() generally ignores visibility. + * TODO: Should we use EG(scope) for the object case instead? */ + RETURN_BOOL(Z_TYPE_P(klass) == IS_OBJECT + || !(func->common.fn_flags & ZEND_ACC_PRIVATE) || func->common.scope == ce); } if (Z_TYPE_P(klass) == IS_OBJECT) { |