How can I remove sensitive data from the debug_backtrace function?
Posted
by RenderIn
on Stack Overflow
See other posts from Stack Overflow
or by RenderIn
Published on 2010-04-16T15:33:44Z
Indexed on
2010/04/16
16:13 UTC
Read the original article
Hit count: 296
php
|debug-backtrace
I am using print_r(debug_backtrace(), true) to retrieve a string representation of the debug backtrace. This works fine, as print_r handles recursion.
When I tried to recursively iterate through the debug_backtrace() return array before turning it into a string it ran into recursion and never ended.
Is there some simple way I can remove certain sensitive key/value pairs from the backtrace array? Perhaps some way to turn the array to a string using print_r, then back to an array with the recursive locations changed to the string RECURSION, which I could the iterate through.
I don't want to execute regular expressions on the string representation if possible.
© Stack Overflow or respective owner