On Tue, Jul 22, 2014 at 7:23 PM, Aaron Lewis <the.warl0ck.1...@gmail.com> wrote:
>
> 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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to