|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53019 to obtain the name of instance in the ReflectionObject class
Submitted: 2010-10-08 00:42 UTC Modified: 2010-10-08 02:19 UTC
From: ngualano at yahoo dot it Assigned:
Status: Not a bug Package: Reflection related
PHP Version: 5.2.14 OS: windows
Private report: No CVE-ID: None
 [2010-10-08 00:42 UTC] ngualano at yahoo dot it
why, the property 'name' in the ReflectionObject, returns the name of the class 
instead of name of instance of class?
we have, already the method 'getName' for obtain the class name;

Please implements this change, i need to obtain the name of instance inside of 
constructor and other methods.

Test script:
   class storage {
      function __construct(){
         $p= new ReflectionObject($this);
         echo $p->name;

   $mystore = new storage('pub');
   //when the object is constructed echo() display 'storage' instead 'mystore'


Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-08 02:19 UTC]
-Status: Open +Status: Bogus
 [2010-10-08 02:19 UTC]
Not possible/wouldn't make sense. As to the second part, there is no sensible solution for this case:

$mystore = new storage('pub');
$mystore2 = $mystore;


$this->prop = new storage('pub');
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 21:01:32 2024 UTC