Re: protected/private access and var_dump/print_r
| From: | Sara Golemon | Date: | Tue, 18 May 2004 14:32:27 +0000 |
| Subject: | Re: protected/private access and var_dump/print_r | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9943@lists.php.net to get a copy of this message | ||
> var_dump($someobject); shows only public properties (as I'd expect), but
> print_r($someobject) shows all properties (explicitly identifying
> protected/private props).
>
So, to sum up the responses to the above question:
1) It's okay for print_r/var_dump to expose public/protected members (their
access rights apply to the program, not the person)
2) print_r() shouldn't change a thing.
3) var_dump() *may* deserve a change to allow it to show private/protected
props (There's an objection to this because....?...) Further would this
qualify as a bugfix or more of a feature change?
The next question that brings up then is in relation to bug#27798:
I would think that get_object_vars() should expose private/protected props
when called from within the class itself (as appropriate based on
inheretance of course). Is this assumption true?
-Sara