Edit report at http://bugs.php.net/bug.php?id=53019&edit=1
ID: 53019 Updated by: [email protected] Reported by: ngualano at yahoo dot it Summary: to obtain the name of instance in the ReflectionObject class -Status: Open +Status: Bogus Type: Feature/Change Request Package: Reflection related Operating System: windows PHP Version: 5.2.14 Block user comment: N New Comment: 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; or $this->prop = new storage('pub'); Previous Comments: ------------------------------------------------------------------------ [2010-10-08 00:42:59] ngualano at yahoo dot it Description: ------------ 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: --------------- <?php 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: ---------------- mystore Actual result: -------------- storage ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53019&edit=1
