Edit report at https://bugs.php.net/bug.php?id=63468&edit=1

 ID:                 63468
 Patch added by:     larue...@php.net
 Reported by:        patrik at votocek dot cz
 Summary:            wrong called method as callback with inheritance
 Status:             Open
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   ArchLinux
 PHP Version:        5.4.8
 Block user comment: N
 Private report:     N

 New Comment:

The following patch has been added/updated:

Patch Name: bug63468.patch
Revision:   1352387087
URL:        
https://bugs.php.net/patch-display.php?bug=63468&patch=bug63468.patch&revision=1352387087


Previous Comments:
------------------------------------------------------------------------
[2012-11-08 13:18:39] patrik at votocek dot cz

Description:
------------
callback call private method (in parent class) instead of public method in 
current class

Test script:
---------------
<?php

class Foo
{
        public function run()
        {
                return call_user_func(array('Bar', 'getValue'));
        }

        private static function getValue()
        {
                return 'Foo';
        }
}

class Bar extends Foo
{
        public static function getValue()
        {
                return 'Bar';
        }
}

$x = new Bar;
$x->run();

Expected result:
----------------
'Bar'

Actual result:
--------------
'Foo'


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63468&edit=1

Reply via email to