cleaner way of debugging
am 14.08.2007 00:25:48 von laredotornado
Hi,
I'm using PHP 4.4.4 witih Apache 2 on Linux. I sadly do not have
control over my hosting environment and cannot upgrade the setup. I
recently discovered the debug_backtrace() statement. However, when I
run the command,
print_r(debug_backtrace());
what is printed out is a mess. See below. Does anyone have a cleaner
way of printing out stack traces?
Thanks, - Dave
array(4) { [0]=> array(4) { ["file"]=> string(65) "/usr/local/apache2/
htdocs/refillingstation/custom_product_fns.php" ["line"]=> int(184)
["function"]=> string(10) "executesql" ["args"]=> array(1) { [0]=>
&string(133) "UPDATE ORDER_FORM_CARTRIDGES SET PRICE = ROUND(3, 2),
RETAIL_PRICE = ROUND(4, 2) WHERE P.PRODUCT_ID = 32647) WHERE
PRODUCT_ID = 32647" } } [1]=> array(4) { ["file"]=> string(65) "/usr/
local/apache2/htdocs/refillingstation/
custom_product_fns.php" ["line"]=> int(148) ["function"]=> string(17)
"updatecustomprice" ["args"]=> array(7) { [0]=> &string(1) "6" [1]=>
&string(1) "2" [2]=> &string(6) "C4844A" [3]=> &string(9) "#10
Black" [4]=> &float(3) [5]=> &float(4) [6]=> &string(0) "" } } [2]=>
array(4) { ["file"]=> string(96) "/usr/local/apache2/htdocs/
refillingstation/admin/custom_prices/
import_custom_prices_response.php" ["line"]=> int(24) ["function"]=>
string(19) "updatecustompricing" ["args"]=> array(2) { [0]=>
&string(14) "/tmp/php7TxSi7" [1]=> &string(1) "2" } } [3]=> array(4)
{ ["file"]=> string(66) "/usr/local/apache2/htdocs/refillingstation/
admin/accesscontrol.php" ["line"]=> int(58) ["args"]=> array(1)
{ [0]=> string(96) "/usr/local/apache2/htdocs/refillingstation/admin/
custom_prices/import_custom_prices_response.php" } ["function"]=>
string(7) "include" } }
Re: cleaner way of debugging
am 14.08.2007 00:29:23 von luiheidsgoeroe
On Tue, 14 Aug 2007 00:25:48 +0200, laredotornado@zipmail.com =
wrote:
> Hi,
>
> I'm using PHP 4.4.4 witih Apache 2 on Linux. I sadly do not have
> control over my hosting environment and cannot upgrade the setup. I
> recently discovered the debug_backtrace() statement. However, when I
> run the command,
>
> print_r(debug_backtrace());
>
> what is printed out is a mess. See below. Does anyone have a cleaner=
> way of printing out stack traces?
>
> Thanks, - Dave
>
> array(4) { [0]=3D> array(4) { ["file"]=3D> string(65) "/usr/local/apac=
he2/
> htdocs/refillingstation/custom_product_fns.php" ["line"]=3D> int(184)
> ["function"]=3D> string(10) "executesql" ["args"]=3D> array(1) { [0]=3D=
>
> &string(133) "UPDATE ORDER_FORM_CARTRIDGES SET PRICE =3D ROUND(3, 2),
> RETAIL_PRICE =3D ROUND(4, 2) WHERE P.PRODUCT_ID =3D 32647) WHERE
> PRODUCT_ID =3D 32647" } } [1]=3D> array(4) { ["file"]=3D> string(65) "=
/usr/
> local/apache2/htdocs/refillingstation/
> custom_product_fns.php" ["line"]=3D> int(148) ["function"]=3D> string(=
17)
> "updatecustomprice" ["args"]=3D> array(7) { [0]=3D> &string(1) "6" [1]=
=3D>
> &string(1) "2" [2]=3D> &string(6) "C4844A" [3]=3D> &string(9) "#10
> Black" [4]=3D> &float(3) [5]=3D> &float(4) [6]=3D> &string(0) "" } } [=
2]=3D>
> array(4) { ["file"]=3D> string(96) "/usr/local/apache2/htdocs/
> refillingstation/admin/custom_prices/
> import_custom_prices_response.php" ["line"]=3D> int(24) ["function"]=3D=
>
> string(19) "updatecustompricing" ["args"]=3D> array(2) { [0]=3D>
> &string(14) "/tmp/php7TxSi7" [1]=3D> &string(1) "2" } } [3]=3D> array(=
4)
> { ["file"]=3D> string(66) "/usr/local/apache2/htdocs/refillingstation/=
> admin/accesscontrol.php" ["line"]=3D> int(58) ["args"]=3D> array(1)
> { [0]=3D> string(96) "/usr/local/apache2/htdocs/refillingstation/admin=
/
> custom_prices/import_custom_prices_response.php" } ["function"]=3D>
> string(7) "include" } }
>
Well, surrounding it with tags would help.
debug_print_backtrace() (officially PHP5) could also help you, it's in =
PEAR::PHP_Compat.
For really thorough debugging info I'd recommend the xdebug extentiont.
-- =
Rik Wasmus
Re: cleaner way of debugging
am 17.08.2007 19:37:31 von Koncept
In article <1187043948.180405.91570@g12g2000prg.googlegroups.com>,
<"laredotornado@zipmail.com"> wrote:
> Hi,
>
> I'm using PHP 4.4.4 witih Apache 2 on Linux. I sadly do not have
> control over my hosting environment and cannot upgrade the setup. I
> recently discovered the debug_backtrace() statement. However, when I
> run the command,
>
> print_r(debug_backtrace());
>
> what is printed out is a mess. See below. Does anyone have a cleaner
> way of printing out stack traces?
>
> Thanks, - Dave
>
> array(4) { [0]=> array(4) { ["file"]=> string(65) "/usr/local/apache2/
> htdocs/refillingstation/custom_product_fns.php" ["line"]=> int(184)
> ["function"]=> string(10) "executesql" ["args"]=> array(1) { [0]=>
> &string(133) "UPDATE ORDER_FORM_CARTRIDGES SET PRICE = ROUND(3, 2),
> RETAIL_PRICE = ROUND(4, 2) WHERE P.PRODUCT_ID = 32647) WHERE
> PRODUCT_ID = 32647" } } [1]=> array(4) { ["file"]=> string(65) "/usr/
> local/apache2/htdocs/refillingstation/
> custom_product_fns.php" ["line"]=> int(148) ["function"]=> string(17)
> "updatecustomprice" ["args"]=> array(7) { [0]=> &string(1) "6" [1]=>
> &string(1) "2" [2]=> &string(6) "C4844A" [3]=> &string(9) "#10
> Black" [4]=> &float(3) [5]=> &float(4) [6]=> &string(0) "" } } [2]=>
> array(4) { ["file"]=> string(96) "/usr/local/apache2/htdocs/
> refillingstation/admin/custom_prices/
> import_custom_prices_response.php" ["line"]=> int(24) ["function"]=>
> string(19) "updatecustompricing" ["args"]=> array(2) { [0]=>
> &string(14) "/tmp/php7TxSi7" [1]=> &string(1) "2" } } [3]=> array(4)
> { ["file"]=> string(66) "/usr/local/apache2/htdocs/refillingstation/
> admin/accesscontrol.php" ["line"]=> int(58) ["args"]=> array(1)
> { [0]=> string(96) "/usr/local/apache2/htdocs/refillingstation/admin/
> custom_prices/import_custom_prices_response.php" } ["function"]=>
> string(7) "include" } }
>
This would do the trick..
printf("
%s
",debug_backtrace(),TRUE) ?>
Re: cleaner way of debugging
am 17.08.2007 19:43:53 von Koncept
In article <170820071337313347%user@unknown.invalid>, Koncept
wrote:
> This would do the trick..
>
> printf("%s
",debug_backtrace(),TRUE) ?>
Oops. Sorry. Forgot the print_r
printf("%s
",print_r(debug_backtrace(),TRUE)) ?>