php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60367 Reflection and Late Static Binding
Submitted: 2011-11-23 16:57 UTC Modified: 2011-11-24 09:18 UTC
Votes:4
Avg. Score:4.8 ± 0.4
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: woody dot gilk at kohanaframework dot org Assigned: laruence (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3.8 OS: OSX 10.6.8
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: woody dot gilk at kohanaframework dot org
New email:
PHP Version: OS:

 

 [2011-11-23 16:57 UTC] woody dot gilk at kohanaframework dot org
Description:
------------
When calling a method that exists only in the parent class with Reflection, the 
incorrect class is used.

This bug is highly related to #53742, but has a different test case. The root 
cause may be exactly the same.

Test script:
---------------
abstract class A {

	const WHAT = 'wrong';

	public static function call() {
		echo static::WHAT;
	}

}

class B extends A {

	const WHAT = 'correct';

}

B::call();

$class = new ReflectionClass('B');
$class->getMethod('call')->invoke(null);


Expected result:
----------------
"correct"

Actual result:
--------------
"wrong"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-24 09:03 UTC] laruence@php.net
-Assigned To: +Assigned To: laruence
 [2011-11-24 09:15 UTC] laruence@php.net
Automatic comment from SVN on behalf of laruence
Revision: http://svn.php.net/viewvc/?view=revision&revision=319745
Log: Fixed bug #60367 (Reflection and Late Static Binding)
 [2011-11-24 09:18 UTC] laruence@php.net
-Status: Assigned +Status: Closed
 [2011-11-24 09:18 UTC] laruence@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2012-04-18 09:47 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e0137255164d3eb544efd9737ebb5f76477e7f33
Log: Fixed bug #60367 (Reflection and Late Static Binding)
 [2012-07-24 23:38 UTC] rasmus@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e0137255164d3eb544efd9737ebb5f76477e7f33
Log: Fixed bug #60367 (Reflection and Late Static Binding)
 [2013-04-03 20:26 UTC] david at orlandophp dot org
Any chance this will be back-ported to older versions of PHP? This bug affects 
the Reflection API in all versions of PHP from 5.3 to 5.3.8, which is widely 
distributed. A patch release would be appreciated.
 [2013-11-17 09:35 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e0137255164d3eb544efd9737ebb5f76477e7f33
Log: Fixed bug #60367 (Reflection and Late Static Binding)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 15:01:30 2024 UTC