php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32296 get_class_methods output has changed between 5.0.2 and 5.0.3
Submitted: 2005-03-14 04:45 UTC Modified: 2005-05-03 10:52 UTC
From: php dot bug at hebbron dot com Assigned: andi (profile)
Status: Closed Package: Class/Object related
PHP Version: 5.* OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
15 + 33 = ?
Subscribe to this entry?

 
 [2005-03-14 04:45 UTC] php dot bug at hebbron dot com
Description:
------------
Using the code below, the output from get_class_methods is different between versions 5.0.2 and 5.0.3. This missing data is breaking some of our code. Is this change intended - I can't see it mentioend in the docs.

Reproduce code:
---------------
abstract class space{
	function __construct(){}
	abstract protected function unfold();
}

abstract class shape extends space{
	protected final function unfold(){}
}

abstract class quad extends shape{
	function buggy(){
		$c = get_class($this);
		$a = get_class_methods(get_class($this));
		$b = get_class_methods($this);
		print($c."\n".'a:');
		print_r($a);
		print('b:');
		print_r($b);
	}
}

class square extends quad{}

$a = new square();
$a->buggy();

Expected result:
----------------
square
a:Array
(
    [0] => buggy
    [1] => unfold
    [2] => __construct
)
b:Array
(
    [0] => buggy
    [1] => unfold
    [2] => __construct
)

Actual result:
--------------
square
a:Array
(
    [0] => buggy
    [1] => __construct
)
b:Array
(
    [0] => buggy
    [1] => __construct
)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-14 04:46 UTC] php dot bug at hebbron dot com
Sorry - the expected output is from php 5.0.2 and the actual output is from 5.0.3 in case that wasn't clear.
 [2005-05-03 10:52 UTC] dmitry@php.net
Fixed in CVS HEAD and PHP_5_0.
Now get_class_methods() shows accessible private and protected methods if it is called from class scope.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 10:01:29 2024 UTC