xref: /PHP-8.2/Zend/tests/debug_info.phpt (revision 7aacc705)
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?>
30--EXPECTF--
31object(Foo)#%d (3) {
32  ["a"]=>
33  int(1)
34  ["b":protected]=>
35  int(2)
36  ["c":"Foo":private]=>
37  int(3)
38}
39object(Bar)#%d (0) {
40}
41