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

 ID:                 40348
 Comment by:         rasmus at mindplay dot dk
 Reported by:        thc at forestfactory dot de
 Summary:            Reading of private/protected properties should be
                     allowed for Reflection API
 Status:             Bogus
 Type:               Bug
 Package:            Class/Object related
 Operating System:   *
 PHP Version:        *
 Block user comment: N
 Private report:     N

 New Comment:

The following method enables access to protected and private properties:



http://de3.php.net/manual/en/reflectionproperty.setaccessible.php


Previous Comments:
------------------------------------------------------------------------
[2007-02-04 10:09:36] he...@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Use var_dump

------------------------------------------------------------------------
[2007-02-04 06:54:30] thc at forestfactory dot de

Description:
------------
"Fixing" "bug" #37816 in PHP 5.2.0 made Reflection more or less useless for the 
one purpose I used it for: reverse-engineering  and debugging. While I can 
understand that there might be a reason for disallowing "setValue" on 
private/protected properties, why shouldn't I be allowed to read the value of a 
property? 



I wrote a nice debugger/reflection class for 5.1.x which stopped working now. 
And what will I do? I will use print_r() or var_export() and parse the output 
using regular expressions or something to get the value. So what is the point 
of this? I still get the value. You just made my code less readable and more 
performance consuming



IMHO this was never a bug! And as #24852 mentions it isn't a bug that print_r() 
gives access to values of non-public properties



Regards Thomas



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



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

Reply via email to