#47254 [Asn->Ver]: Wrong Reflection for extends class

From: Date: Mon, 27 Apr 2009 16:47:27 +0000
Subject: #47254 [Asn->Ver]: Wrong Reflection for extends class
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-136393@lists.php.net to get a copy of this message
 ID:               47254
 Updated by:       jani@php.net
 Reported By:      ivan1986 at list dot ru
-Status:           Assigned
+Status:           Verified
 Bug Type:         Reflection related
-Operating System: Linux Debian
+Operating System: *
-PHP Version:      5.2.8
+PHP Version:      5.*, 6CVS (2009-04-25)
 Assigned To:      helly


Previous Comments:
------------------------------------------------------------------------

[2009-01-31 19:44:17] felipe@php.net

Hi Marcus, is this actually the behavior expected?
As we have the 'class' array key in the return, I believe that is
really a bug.

Anyway here is a simple fix:
http://felipe.ath.cx/diff/bug47254.diff

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

[2009-01-30 23:15:48] ivan1986 at list dot ru

Description:
------------
I test this in two version:

ivan@ivan1986:~% /usr/bin/php -v
PHP 5.2.6-3 with Suhosin-Patch 0.9.6.2 (cli) (built: Jan 25 2009
00:51:23)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
    with XCache v1.2.2, Copyright (c) 2005-2007, by mOo

ivan@ivan1986:~% php -v
PHP 6.0.0-dev (cli) (built: Nov  8 2008 02:31:17)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2008 Zend Technologies

in CVS error now.

Reproduce code:
---------------
<?php

class A
{
	protected function a() {}
	
}

class B extends A
{
	public function b() {}
}

$B = new B();
$R = new ReflectionObject($B);
$m = $R->getMethods();
print_r($m);

?>

Expected result:
----------------
Array
(
    [0] => ReflectionMethod Object
        (
            [name] => b
            [class] => B
        )

    [1] => ReflectionMethod Object
        (
            [name] => a
            [class] => A
        )

)


Actual result:
--------------
Array
(
    [0] => ReflectionMethod Object
        (
            [name] => b
            [class] => B
        )

    [1] => ReflectionMethod Object
        (
            [name] => a
            [class] => B
        )

)



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


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



Thread (6 messages)

« previous php.bugs (#136393) next »