| Bug #36693 | get_object_vars does not return private members | ||||
|---|---|---|---|---|---|
| Submitted: | 11 Mar 2006 3:21am UTC | Modified: | 16 Aug 2006 9:13pm UTC | ||
| From: | iain at iaindooley dot com | Assigned to: | |||
| Status: | No Feedback | Category: | Class/Object related | ||
| Version: | 5.1.2 | OS: | FreeBSD 6.0 | ||
| Votes: | 7 | Avg. Score: | 3.4 ± 1.7 | Reproduced: | 0 of 1 (0.0%) |
[11 Mar 2006 3:21am UTC] iain at iaindooley dot com
[15 Mar 2006 4:04pm UTC] mike@php.net
Please try using this CVS snapshot: http://snaps.php.net/php5.1-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.1-win32-latest.zip Cannot reproduce.
[23 Mar 2006 1:00am UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[16 Aug 2006 8:48pm UTC] thomas at epiphantastic dot com
I'm experiencing this same problem, running PHP on Windows with both
Apache and IIS. Here's the code:
<?php
class TestClass {
private $var1 = "private";
protected $var2 = "protected";
public $var3 = "public";
}
$o = new TestClass();
foreach(array_keys(get_object_vars($o)) as $key)
echo $key;
?>
I'd expect to see 3 values outputted but only one comes back.
[16 Aug 2006 8:50pm UTC] thomas at epiphantastic dot com
Forgot to say, I'm running PHP 5.1.2
[16 Aug 2006 9:13pm UTC] tony2001@php.net
That's correct behavior, since you're calling it outside of the object scope.
