1--TEST-- 2Testing __debugInfo() magic method 3--FILE-- 4<?php 5 6class Foo { 7 public $d = 4; 8 protected $e = 5; 9 private $f = 6; 10 11 public function __debugInfo() { 12 return ['a'=>1, "\0*\0b"=>2, "\0Foo\0c"=>3]; 13 } 14} 15 16class Bar { 17 public $val = 123; 18 19 public function __debugInfo() { 20 return null; 21 } 22} 23 24$f = new Foo; 25var_dump($f); 26 27$b = new Bar; 28var_dump($b); 29--EXPECTF-- 30object(Foo)#%d (3) { 31 ["a"]=> 32 int(1) 33 ["b":protected]=> 34 int(2) 35 ["c":"Foo":private]=> 36 int(3) 37} 38object(Bar)#%d (0) { 39} 40