<?php
class myClass
{
function myClass()
{
}
}
$php5 = version_compare(phpversion(), '5.0.0', '>=');
if (!$php5) {
require_once 'dpb3.php';
require_once 'PHP/Compat.php';
PHP_Compat::loadFunction('debug_print_backtrace');
}
error_reporting (E_ALL);
function debug($var, $val)
{
echo "***Deboggage\nVariable : $var\nValeur :";
if (is_array($val) || is_object($val) || is_resource($val)) {
print_r($val);
} else {
echo "\n$val\n";
}
debug_print_backtrace();
echo "***\n";
}
$host = $_SERVER["SERVER_NAME"];
call_user_func_array('debug', array("host", $host));
$myClass = new myClass();
call_user_func_array('debug', array("myClass", $myClass));
$fp = fopen('php://stderr', 'wb');
call_user_func_array('debug', array("fp", $fp));
fclose($fp);
/*
fixed debug_print_backtrace : dpb3.php
--------------------------------------------------------------------------------
***Deboggage
Variable : host
Valeur :
localhost
#0 debug(host, localhost) called at [(null):0]
#1 call_user_func_array(debug, Array
(
[0] => host
[1] => localhost
)
) called at [(...)\php\debug_print_backtrace.php:33]
***
***Deboggage
Variable : myClass
Valeur :myclass Object
(
)
#0 debug(myClass, myclass) called at [(null):0]
#1 call_user_func_array(debug, Array
(
[0] => myClass
[1] => myclass Object
(
)
)
) called at [(...)\php\debug_print_backtrace.php:36]
***
***Deboggage
Variable : fp
Valeur :Resource id #4
#0 debug(fp, Resource id #4) called at [(null):0]
#1 call_user_func_array(debug, Array
(
[0] => fp
[1] => Resource id #4
)
) called at [(...)\php\debug_print_backtrace.php:39]
***
--------------------------------------------------------------------------------
*/
/*
fixed debug_print_backtrace : dpb2.php
--------------------------------------------------------------------------------
***Deboggage
Variable : host
Valeur :
localhost
#0 debug(string host, string localhost) called at [Unknown:Unknown]
#1 call_user_func_array(string debug, array) called at [(...)\php\debug_print_backtrace.php:33]
***
***Deboggage
Variable : myClass
Valeur :myclass Object
(
)
#0 debug(string myClass, myclass) called at [Unknown:Unknown]
#1 call_user_func_array(string debug, array) called at [(...)\php\debug_print_backtrace.php:36]
***
***Deboggage
Variable : fp
Valeur :Resource id #4#0 debug(string fp, resource) called at [Unknown:Unknown]
#1 call_user_func_array(string debug, array) called at [(...)\php\debug_print_backtrace.php:39]
***
--------------------------------------------------------------------------------
*/
/*
PHP 4.4.2 and PHP/Compat 1.5.0 debug_print_backtrace()
--------------------------------------------------------------------------------
***Deboggage
Variable : host
Valeur :
localhost
<br />
<b>Notice</b>: Undefined index: file in <b>(...)\php4\pear\PHP\Compat\Function\debug_print_backtrace.php</b> on line <b>46</b><br />
<br />
<b>Notice</b>: Undefined index: line in <b>(...)\php4\pear\PHP\Compat\Function\debug_print_backtrace.php</b> on line <b>46</b><br />
<br />
<b>Notice</b>: Array to string conversion in <b>(...)\php4\pear\PHP\Compat\Function\debug_print_backtrace.php</b> on line <b>53</b><br />
#0 debug(host, localhost) called at [:]
#1 call_user_func_array(debug, Array) called at [(...)\php\debug_print_backtrace.php:33]
***
***Deboggage
Variable : myClass
Valeur :myclass Object
(
)
<br />
<b>Notice</b>: Undefined index: file in <b>(...)\php4\pear\PHP\Compat\Function\debug_print_backtrace.php</b> on line <b>46</b><br />
<br />
<b>Notice</b>: Undefined index: line in <b>(...)\php4\pear\PHP\Compat\Function\debug_print_backtrace.php</b> on line <b>46</b><br />
<br />
<b>Notice</b>: Object to string conversion in <b>(...)\php4\pear\PHP\Compat\Function\debug_print_backtrace.php</b> on line <b>53</b><br />
<br />
<b>Notice</b>: Array to string conversion in <b>(...)\php4\pear\PHP\Compat\Function\debug_print_backtrace.php</b> on line <b>53</b><br />
#0 debug(myClass, Object) called at [:]
#1 call_user_func_array(debug, Array) called at [(...)\php\debug_print_backtrace.php:36]
***
***Deboggage
Variable : fp
Valeur :Resource id #4<br />
<b>Notice</b>: Undefined index: file in <b>(...)\php4\pear\PHP\Compat\Function\debug_print_backtrace.php</b> on line <b>46</b><br />
<br />
<b>Notice</b>: Undefined index: line in <b>(...)\php4\pear\PHP\Compat\Function\debug_print_backtrace.php</b> on line <b>46</b><br />
<br />
<b>Notice</b>: Array to string conversion in <b>(...)\php4\pear\PHP\Compat\Function\debug_print_backtrace.php</b> on line <b>53</b><br />
#0 debug(fp, Resource id #4) called at [:]
#1 call_user_func_array(debug, Array) called at [(...)\php\debug_print_backtrace.php:39]
***
--------------------------------------------------------------------------------
*/
/*
PHP 5.1.2 debug_print_backtrace()
--------------------------------------------------------------------------------
***Deboggage
Variable : host
Valeur :
localhost
#0 debug(host, localhost) called at [(null):0]
#1 call_user_func_array(debug, Array ([0] => host,[1] => localhost)) called at [(...)\php\debug_print_backtrace.php:33]
***
***Deboggage
Variable : myClass
Valeur :myClass Object
(
)
#0 debug(myClass, myClass Object ()) called at [(null):0]
#1 call_user_func_array(debug, Array ([0] => myClass,[1] => myClass Object ())) called at [(...)\php\debug_print_backtrace.php:36]
***
***Deboggage
Variable : fp
Valeur :Resource id #3
#0 debug(fp, Resource id #3) called at [(null):0]
#1 call_user_func_array(debug, Array ([0] => fp,[1] => Resource id #3)) called at [(...)\php\debug_print_backtrace.php:39]
***
--------------------------------------------------------------------------------
*/
?>