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--EXPECT-- 41---( Declaring class: )--- 42B::testB 43array(4) { 44 ["hiddenPriv"]=> 45 string(13) "B::hiddenPriv" 46 ["priv"]=> 47 string(7) "B::priv" 48 ["prot"]=> 49 string(7) "B::prot" 50 ["pub"]=> 51 string(6) "B::pub" 52} 53 54---( Superclass: )--- 55A::testA 56array(3) { 57 ["prot"]=> 58 string(7) "B::prot" 59 ["pub"]=> 60 string(6) "B::pub" 61 ["hiddenPriv"]=> 62 string(13) "A::hiddenPriv" 63} 64