Hi,
How can I know the line no in eval()'d code?
e.g eval()'d code on line 1 (I couldn't find the definition of that
output, so I had to ask it here)
zend_get_executed_lineno(TSRMLS_C) doesn't seem to be the right value
Also, I'm not sure how to tell if the code is in eval() either
--
Best Regards,
Aaron Lewis - PGP: 0x13714D33 - http://pgp.mit.edu/
Finger Print: 9F67 391B B770 8FF6 99DC D92D 87F6 2602 1371 4D33
Hi,
How can I know the line no in eval()'d code?
e.g eval()'d code on line 1 (I couldn't find the definition of that
output, so I had to ask it here)zend_get_executed_lineno(TSRMLS_C) doesn't seem to be the right value
AFAIK, it's all one string, so on one line. At least that's what the
engine "thinks".
Also, I'm not sure how to tell if the code is in eval() either
zend_get_executed_filename has "eval()'d code" in the output:
https://github.com/derickr/xdebug/blob/master/xdebug_handler_dbgp.c#L378
cheers,
Derick
--
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug
Posted with an email client that doesn't mangle email: alpine
How can I know the line no in eval()'d code?
Are you asking how to determine where the eval'd code was called from?
There's a way, but it's a bit messy:
Walk up EG(current_execute_data) until you get to the opline pointing
at ZEND_EVAL (this will probably be the current stack, or one above,
depending on where your error got thrown from). opline->lineno will
have the line number where eval was called from.
You can take a look at the implementation for debug_backtrace()
for
inspiration if need be. Just bear in mind that eval() is an op, not a
function.
Also, I'm not sure how to tell if the code is in eval() either
As Derick mentioned, the "executed file" is a good hint. Though if
you're walking up the execute data already, you'll probabaly notice
the ZEND_EVAL instruction along the way.
-Sara