Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75967 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68440 invoked from network); 23 Jul 2014 16:38:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Jul 2014 16:38:54 -0000 Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.192.171 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.192.171 mail-pd0-f171.google.com Received: from [209.85.192.171] ([209.85.192.171:35290] helo=mail-pd0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DF/11-61324-C15EFC35 for ; Wed, 23 Jul 2014 12:38:54 -0400 Received: by mail-pd0-f171.google.com with SMTP id z10so1926587pdj.30 for ; Wed, 23 Jul 2014 09:38:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=f8Fg8OXipeQK3VyYZQUWPoFK+hRM7RSjpt7XkeKkNa4=; b=MKfdGC5XnXwFOl01r/84gbQkX+jasks1q30nDgvlTb+7yQjrgPX9oB+X1tlzMh/Rer 9DImK6DqQEXcU4nD36yxaC+7VWELaR6AYiWJrythNyaAdLCTDyDfn/GfdU+skynUPdEm zP/k/w+vbTKiEhtxW/+T/wBgy1czitYUzx1ufPZMO7M/qLJxT7hQce901kO2vdGBMMer ReDo4Y7szOB3r+SKBPzVFANLRUMllm8XN28qPF1x2sJXNp1AljyAgB2tx9BVNKOKLoaM 5IOFBoCdWpggDU03iBh+YI8PJ4A0OvaNo+Eh73j+by/y2XYFsf4wYjmF/hocm2cDBPEQ 3f1A== X-Gm-Message-State: ALoCoQkhRFYMFLE8jg/Il8nIq/7zh9b1qzqo0Qm8LuA8rviiAHDGw8x8jGkPSbhGsegyUZMYziX/ MIME-Version: 1.0 X-Received: by 10.70.44.2 with SMTP id a2mr3540168pdm.38.1406133532178; Wed, 23 Jul 2014 09:38:52 -0700 (PDT) Sender: php@golemon.com Received: by 10.70.33.208 with HTTP; Wed, 23 Jul 2014 09:38:52 -0700 (PDT) X-Originating-IP: [69.63.185.56] In-Reply-To: References: Date: Wed, 23 Jul 2014 09:38:52 -0700 X-Google-Sender-Auth: gnDJFgFMeBcHRukcVmSFhm0sI30 Message-ID: To: Aaron Lewis Cc: PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] How do I know if the code is in eval? From: pollita@php.net (Sara Golemon) On Tue, Jul 22, 2014 at 7:23 PM, Aaron Lewis 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