mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fixed bug #78632
I'm going for a very conservative fix here, where the previous logic is restored for the case where an object is passed to method_exists(). We might want to check against EG(scope) instead, but this seems like a safer choice. This means that behavior in PHP 7.4 changes only for method_exists('C', 'privateMethodNotOnC'), which should be sensible.
This commit is contained in:
parent
9659562cb5
commit
ca652aafa8
4 changed files with 11 additions and 5 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue