I propse following for getting Public members, always:
<?PHP
if (!function_exists("get_public_class_vars")) {
function get_public_class_vars($class) {
return get_class_vars($class);
}
}
if (!function_exists("get_public_object_vars")) {
function get_public_object_vars($object) {
return get_object_vars($object);
}
}
?>
This is to mitigate the problem and a feature that get_object_vars($this) returns private members. Running it simply outside the scope will get the public.
Iterating public members only and their defaults are enormously useful in e.g. in serialization classes such as options where each public member is an serializable that is saved and loaded.