php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48392 Reflection API does not see parameter list for __get()
Submitted: 2009-05-26 00:33 UTC Modified: 2009-05-26 00:53 UTC
From: php at adamashley dot name Assigned:
Status: Not a bug Package: Reflection related
PHP Version: 5.2.9 OS: Ubuntu 9.04
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:
9 - 8 = ?
Subscribe to this entry?

 
 [2009-05-26 00:33 UTC] php at adamashley dot name
Description:
------------
The Reflection API does not return details of the parameter list for __get()

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

class testReflect
{
    function get( $name )
    {
        return $name;
    }

    function __get( $name )
    {
        switch( $name )
        {
            case 'one':
                return 1;

            case 'two':
                return 2;
        }
    }
}

$class = new ReflectionClass('testReflect');
$method = $class->getMethod('__get');
$parameters = $method->getParameters();

print "testReflect::__get()\n";
print_r($prarmeters);

$method = $class->getMethod('get');
$parameters = $method->getParameters();

print "testReflect::get()\n";
print_r($parameters);

?>

Expected result:
----------------
testReflect::__get()
Array
(
    [0] => ReflectionParameter Object
        (
            [name] => name
        )

)
testReflect::get()
Array
(
    [0] => ReflectionParameter Object
        (
            [name] => name
        )

)


Actual result:
--------------
testReflect::__get()
testReflect::get()
Array
(
    [0] => ReflectionParameter Object
        (
            [name] => name
        )

)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-26 00:53 UTC] felipe@php.net
Hello,
You mistyped 'parameters': print_r($prarmeters);

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 20:01:30 2024 UTC