1--TEST-- 2get_object_vars(): visibility from non static methods (target object passed as arg) 3--FILE-- 4<?php 5/* Prototype : proto array get_object_vars(object obj) 6 * Description: Returns an array of object properties 7 * Source code: Zend/zend_builtin_functions.c 8 * Alias to functions: 9 */ 10 11Class A { 12 private $hiddenPriv = 'A::hiddenPriv'; 13 14 public function testA($b) { 15 echo __METHOD__ . "\n"; 16 var_dump(get_object_vars($b)); 17 } 18} 19 20Class B extends A { 21 private $hiddenPriv = 'B::hiddenPriv'; 22 private $priv = 'B::priv'; 23 protected $prot = 'B::prot'; 24 public $pub = 'B::pub'; 25 26 public function testB($b) { 27 echo __METHOD__ . "\n"; 28 var_dump(get_object_vars($b)); 29 } 30} 31 32 33$b = new B; 34echo "\n---( Declaring class: )---\n"; 35$b->testB($b); 36echo "\n---( Superclass: )---\n"; 37$b->testA($b); 38 39?> 40--EXPECTF-- 41 42---( Declaring class: )--- 43B::testB 44array(4) { 45 ["hiddenPriv"]=> 46 string(13) "B::hiddenPriv" 47 ["priv"]=> 48 string(7) "B::priv" 49 ["prot"]=> 50 string(7) "B::prot" 51 ["pub"]=> 52 string(6) "B::pub" 53} 54 55---( Superclass: )--- 56A::testA 57array(3) { 58 ["prot"]=> 59 string(7) "B::prot" 60 ["pub"]=> 61 string(6) "B::pub" 62 ["hiddenPriv"]=> 63 string(13) "A::hiddenPriv" 64}