| aharvey | Yes (5.6) | 2014-02-12 21:02 |
| ajf | Yes (5.6) | 2014-02-05 22:32 |
| bwoebi | Yes (5.6) | 2014-02-03 20:28 |
| chobieeee | Yes (5.6) | 2014-02-11 16:27 |
| chregu | Yes (5.6) | 2014-02-03 20:47 |
| dsp | Yes (5.6) | 2014-02-03 21:51 |
| fa | Yes (5.6) | 2014-02-11 23:08 |
| googleguy | No | 2014-02-12 21:17 |
| indeyets | Yes (5.6) | 2014-02-05 10:04 |
| jpauli | Yes (5.6) | 2014-02-04 10:03 |
| jwage | Yes (5.6) | 2014-02-18 02:18 |
| kassner | Yes (5.6) | 2014-02-18 00:51 |
| krakjoe | Yes (5.6) | 2014-02-03 20:18 |
| levim | No | 2014-02-04 21:20 |
| lstrojny | Yes (5.6) | 2014-02-11 00:43 |
| malukenho | Yes (5.6) | 2014-02-04 22:39 |
| mbeccati | Yes (5.6) | 2014-02-12 10:58 |
| peehaa | Yes (5.6) | 2014-02-03 20:31 |
| pollita | Yes (5.6) | 2014-02-03 20:05 |
| rdlowrey | Yes (5.6) | 2014-02-03 21:47 |
| remi | Yes (5.6) | 2014-02-12 06:53 |
| salathe | Yes (5.7) | 2014-02-03 20:39 |
| sebastian | Yes (5.6) | 2014-02-04 16:25 |
| stas | No | 2014-02-05 20:29 |
| treffynnon | Yes (5.6) | 2014-02-18 00:18 |
| willfitch | Yes (5.6) | 2014-02-12 21:01 |
| yohgaki | Yes (5.6) | 2014-02-03 20:18 |
| aharvey | __debugInfo() | 2014-02-12 21:02 |
| ajf | __debug() | 2014-02-05 22:32 |
| bwoebi | __debugInfo() | 2014-02-03 20:28 |
| chobieeee | __debugInfo() | 2014-02-11 16:27 |
| chregu | __debugInfo() | 2014-02-03 20:48 |
| dsp | __debugInfo() | 2014-02-03 21:51 |
| fa | __debugInfo() | 2014-02-11 23:08 |
| indeyets | __debugInfo() | 2014-02-05 10:04 |
| jpauli | __debugInfo() | 2014-02-04 10:03 |
| krakjoe | __debugInfo() | 2014-02-03 20:18 |
| levim | __debugInfo() | 2014-02-04 21:20 |
| lstrojny | __debugInfo() | 2014-02-09 01:30 |
| malukenho | __debugInfo() | 2014-02-04 22:39 |
| mariuz | __debugInfo() | 2014-02-17 13:34 |
| mbeccati | __debugInfo() | 2014-02-12 10:59 |
| nikic | __debugInfo() | 2014-02-11 20:56 |
| pollita | __debugInfo() | 2014-02-03 20:05 |
| rdlowrey | __debugInfo() | 2014-02-03 21:48 |
| remi | __debugInfo() | 2014-02-12 06:53 |
| salathe | __debugInfo() | 2014-02-03 20:39 |
| sebastian | __debugInfo() | 2014-02-04 16:26 |
| stas | __debugInfo() | 2014-02-06 03:18 |
| willfitch | __debugInfo() | 2014-02-12 21:01 |
| yohgaki | __debugInfo() | 2014-02-03 20:18 |
Copied from wiki.php.net, last synchronized Oct 13, 2026 11:51 UTC
This RFC is for exposing the “get_debug_info” API already available to internal classes (written in C) to PHP classes via a magic method called __debugInfo().
Example Usage:
class File {
// "Resource(stream)" isn't all that useful
private $fp;
// But all the stream meta data is
public function __debugInfo() {
return $this->fp ? stream_get_meta_data($fp) : [];
}
public function open($filename, $mode = 'r'){
$this->fp = fopen($filename, $mode);
}
}
$f = new File;
var_dump($f); // object(File)#1 { }
$f->open('http://php.net');
var_dump($f);
/*
object(File)#1 {
["wrapper_type"]=>
string(4) "http"
["stream_type"]=>
string(10) "tcp_socket"
etc...
*/
Double underscore is a reserved namespace, so any classes which happen to implement this are the ones which need to change.
Existing fallback behavior for internal classes not overriding get_debug_info is preserved via chaining to get_properties when no __debugInfo function is defined.
5.next
IMO, this takes control away from the user and removes a particularly useful reason for having the __debugInfo() magic method in the first place. Consider an object which points at itself (or more likely, another object which points back at the original). This normally results in a recursive loop. This is detected by the var_dump() routine, but only after a couple cycles. A more intelligent __debugInfo() output could avoid any iterations of the loop.
Vote [YES] to merge the __debugInfo() patch. See Vote 2 for options on what name it will have.
Vote: Merge ___debugInfo() — Yes (5.6): 23 · Yes (5.7): 1 · No: 3 (closed)
If Vote 1 passes, what should the userland magic method be called?
Vote: Name ___debugInfo() — __debugInfo(): 23 · __debug(): 1 (closed)