Hey folks,
I'd like to add the local variables for all stack-frames to the result
of debug_backtrace(), i.e. each array entry contains a 'vars' field
pointing to the symbol table of that frame. A patch for PHP4/Zend is
attached.
Opinions?
- Chris
Oops, after I first added FREE_ZVAL(vars) to my patch to get rid of the
memory leak I now realized that it simply doesn't work like this. I
still have to learn about the memory management/gc of Zend I guess :-)
If you want to try my patch and don't care about a memory leak, remove
the line FREE_ZVAL(vars);
- Chris
[...]
I'd like to add the local variables for all stack-frames to the result
ofdebug_backtrace(),
[...]
I'd like having this. Using declare(ticks = 1),
register_tick_function('debug'), and debug_backtrace() you'd be able to
build a simple debugger in PHP userland.
- Timm
Ok, I worked out a patch which does not leak memory. I don't think
thread-safety is an issue here but if anyone with deeper insight into
Zend sees any problem with this patch, please tell me.
What's the process (and chance :-)) of having this included in a future
version of PHP? Should I also look into making a PHP5/Zend2 version of it?
Comments welcome,
- Chris