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