wrong called method as callback with inheritance

Bug #63468 wrong called method as callback with inheritance
Submitted: 2012-11-08 13:18 UTC Modified: 2012-11-08 15:05 UTC
From: patrik at votocek dot cz Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.4.8 OS: ArchLinux
Private report: No CVE-ID: None

 [2012-11-08 13:18 UTC] 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'

Patches

bug63468.patch (last revision 2012-11-08 15:04 UTC by laruence@php.net)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2012-11-08 15:05 UTC] laruence@php.net

dmitry, do you have time to look at this patch? thanks

 [2012-11-20 09:17 UTC] dmitry@php.net

-Status: Assigned +Status: Closed