php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53366 Reflection doesnt get dynamic property value from getProperty()
Submitted: 2010-11-20 13:45 UTC Modified: 2010-11-20 23:54 UTC
From: jorgevpinho at gmail dot com Assigned: felipe (profile)
Status: Closed Package: Reflection related
PHP Version: 5.2.13 OS: WinXP SP3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jorgevpinho at gmail dot com
New email:
PHP Version: OS:

 

 [2010-11-20 13:45 UTC] jorgevpinho at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/reflectionclass.getproperties
---


Test script:
---------------
class UserClass {

}

$myClass = $mysqli_rs->fetch_object("UserClass");

$reflect = new ReflectionClass($myClass);

echo($myClass->property1); //works

$reflect->getProperty('titulo'); // breaks



Expected result:
----------------
no error


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-20 13:47 UTC] jorgevpinho at gmail dot com
-PHP Version: 5.2.14 +PHP Version: 5.2.13
 [2010-11-20 13:47 UTC] jorgevpinho at gmail dot com
I mistyped the last line on Test script :

$reflect->getProperty('property1'); // breaks
 [2010-11-20 15:04 UTC] felipe@php.net
-Status: Open +Status: Feedback
 [2010-11-20 15:04 UTC] felipe@php.net
And using ReflectionObject instead?
 [2010-11-20 15:47 UTC] jorgevpinho at gmail dot com
$reflect = new ReflectionObject($myClass);

$prop = $reflect->getProperty('property1');

echo($prop->getValue());
// Warning: ReflectionProperty::getValue() expects exactly 1 parameter
// doc says its not mandatory

echo($prop->getValue($myClass));
// no error, but nothing happens and no value is returned
 [2010-11-20 22:21 UTC] felipe@php.net
-Summary: Reflection doesnt show propreties from mysqli_fetch_object("UserClass") +Summary: Reflection doesnt get dynamic property value from getProperty() -Status: Feedback +Status: Open
 [2010-11-20 23:53 UTC] felipe@php.net
Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=305589
Log: - Fixed bug #53366 (Reflection doesnt get dynamic property value from getProperty())
 [2010-11-20 23:54 UTC] felipe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: felipe
 [2010-11-20 23:54 UTC] felipe@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 20:01:28 2024 UTC