Bug #78898 [NEW]: call_user_func(['parent'.. fails while other succeed
From: sjon
Operating system: archLinux
PHP version: 7.4.0
Package: Class/Object related
Bug Type: Bug
Bug description:call_user_func(['parent'.. fails while other succeed
Description:
------------
when extending a class that has both a protected method, and a __call -
certain call_user_func calls will end up in __call instead of the
protected method - see https://3v4l.org/4El6Z
Test script:
---------------
<?php
class A
{
protected function _x()
{
echo "a";
}
public function __call($methodName, array $arguments)
{
throw new Exception("Unknown method.");
}
}
class B extends A
{
public function x()
{
parent::_x(); # works
call_user_func('parent::_x'); # works
call_user_func(['parent', '_x']); # fails
}
}
$b = new B;
$b->x();
Expected result:
----------------
aaa
Actual result:
--------------
aa Exception
--
Edit bug report at https://bugs.php.net/bug.php?id=78898&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78898&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78898&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78898&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78898&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78898&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78898&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78898&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78898&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78898&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78898&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78898&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78898&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78898&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78898&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78898&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78898&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78898&r=mysqlcfg
Thread (3 messages)
- sjon@php.net