Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95570 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53005 invoked from network); 2 Sep 2016 14:57:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Sep 2016 14:57:33 -0000 Authentication-Results: pb1.pair.com smtp.mail=dave@mudsite.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dave@mudsite.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain mudsite.com designates 209.85.217.175 as permitted sender) X-PHP-List-Original-Sender: dave@mudsite.com X-Host-Fingerprint: 209.85.217.175 mail-ua0-f175.google.com Received: from [209.85.217.175] ([209.85.217.175:36250] helo=mail-ua0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F7/E8-19490-A5399C75 for ; Fri, 02 Sep 2016 10:57:31 -0400 Received: by mail-ua0-f175.google.com with SMTP id m60so179880999uam.3 for ; Fri, 02 Sep 2016 07:57:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mudsite-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pQaQoEwDS8jw+yYMZ0Gmhs7oOA1O649j/rTcUL3gVq0=; b=YcBdiBxsmFdLkrBguudaAc/zxbXOSzxBh4l/M7dVU/P8ySkNSR1eYYpxL8zrZXO6/s E4eJ/7JwSlYU8SQC4P8JyrIdBdqv2nfD/tU3A5R5hHlc3K3zqr2tl/XBXRQ8TMHEzZxY bQBn10LKzUXhBEHdLjP6tcsxcKoTZYD3x9d48r2YFYQfGzqYqWAm9xmdHjs9ZBUzS8PR ALBvwyLsTjvm64KsPX1bnr0jJFXiiTF1rOPK1zCtmD1WGf4qhxsoPj3agmLGNnh9aUHa 4ms7eZbXWvWNfoJ/aeNXz/PMzAk04b1YtPWM9+7OwoDEI2ykVCLcXZeWT2apnVroqVfR AlAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pQaQoEwDS8jw+yYMZ0Gmhs7oOA1O649j/rTcUL3gVq0=; b=aBuaQWRdOjv8bWNhuc062SY4VIhiehIc+AIJbwm0fbQdaaacmB7F05ZJ/A0YrmLcai WydZNXfGSDm96MCyFDDsqcLe2XL1UcjRQ0rmCAjxif/Yp/T1zXin5MX1eYvh0w60NNZB O7WcRcHbk1MgjjIM354O3g0aGRiQKSbVPv+QlcGwJqTN2lIMQyLENqzvqvhCO/SOKduT DYcQC7DKXcFfSCaEHjYEpDL9r9sw7bEB83T+upuJm+B1idLgc+ruYYVOUeY8l6bSqf9h tNd2MpUyxi+X1S25dW7hMAafONgbbssHRsLtUN6EVSqLy61VRLRjmO3AerhOylhVE7zc bRNg== X-Gm-Message-State: AE9vXwNr0+oY0Gokiowj4DFZQfl9YY5MFsy8N1phdkxcJcLE4MOFrtZybYzU3j9w4/2N9WcgPDcT3MymGZx00A== X-Received: by 10.159.54.140 with SMTP id p12mr13601354uap.19.1472828247825; Fri, 02 Sep 2016 07:57:27 -0700 (PDT) MIME-Version: 1.0 References: <1e6cac8a-e1af-c9e7-a900-a2efda0771dd@gmx.de> In-Reply-To: Date: Fri, 02 Sep 2016 14:57:16 +0000 Message-ID: To: Dmitry Stogov , "Christoph M. Becker" , Marco Pivetta Cc: PHP Internals List , Nikita Popov Content-Type: multipart/alternative; boundary=94eb2c03f48487056e053b878cd3 Subject: Re: [PHP-DEV] Re: [RFC][VOTE] E_WARNING on invalid container read-adccess From: dave@mudsite.com (David Walker) --94eb2c03f48487056e053b878cd3 Content-Type: text/plain; charset=UTF-8 Dmitry, Poking around, I'm must not be understanding how TICK opcodes would negatively impact the lookahead. It may be my newness, but the way I'm reading the compilation of ZEND_AST_DIM, would not be suspect to random TICK opcodes from impacting the lookahead. I see that for a single ZEND_AST_DIM, compilation will recuse emitting all the FETCH_DIM_R opcodes for it in succession. Whereafter, a subsequent call to zend_compile_stmt() will emit the TICK if it was declared. It could also be that I'm unsure what a test example would be that could inject the TICK into the middle, of the DIM compilation. The same applies to the BEGIN/END silence, as they will be wrapped around the entire compilation of the DIM opcodes. [1] has an example using both ticks and silencing, which seems to work as intended emitting a single warning (for the un-silenced access) I'm not exactly sure what you mean by debugging-opcodes here though, however, unless someone is hooking into the compilation and compiling DIM's in a different way, I don't see the inherent problems with the lookahead. I was thinking about the use of an exception, however, I think that'd be a pretty significant shift. It would also be very odd that this case would be the exception throwing one, whereas accessing via reference wouldn't, or any of the undefined indexes wouldn't. It would also impact most user code out there by needing to wrap variable array access in a try{}catch, which would be imposing a pretty large change to php 8.0. That's why I didn't really think shifting to an exception would be appropriate here. Thanks -- Dave [1] - https://gist.github.com/bp1222/18d80e8ec962eba1ba75c99124191a0a On Fri, Sep 2, 2016 at 12:19 AM Dmitry Stogov wrote: > Looking forward won't always work out of the box. > > Take into account possible TICK opcodes, BEGIN/END silence, debugging > opcodes. > > It's probably easier to throw exception, instead of recovery, but this is > a BC break, and might be done only in 8.0. > > > Thanks. Dmitry. > ------------------------------ > *From:* David Walker > *Sent:* Thursday, September 1, 2016 7:40:15 PM > *To:* Dmitry Stogov; Christoph M. Becker; Marco Pivetta > > *Cc:* PHP Internals List; Nikita Popov > *Subject:* Re: [PHP-DEV] Re: [RFC][VOTE] E_WARNING on invalid container > read-adccess > On Thu, Sep 1, 2016 at 1:03 AM Dmitry Stogov wrote: > >> Hi David, >> >> I would propose to cancel voting and restart it when the good >> implementation is found. >> >> Otherwise, people may rise their hands for something that can't be >> implemented in good enough way. >> >> Thanks. Dmitry. >> > > Hi Dmitry (et.al), > > I ended up addressing the problem you raised where simply looking at the > next opcode type wasn't verbose enough, and had the thrown exception. > > So I'm wondering the reasons why looking ahead wouldn't be considered a > good implementation? The attempt to limit the quantity of raised warnings, > and raising once for a null, does need to be aware if the return of our op, > is being used again in the next op. I do notice that in zend_execute > there's no other examples of looking forward an opline, but that it does > exist within zend_vm. I'm wondering if a more acceptable implementation > would be to move the logic of looking-forward and checking if the next > fetch-dim-r to the opcode-handler. > > Or, if your concern is more with the looking-forward in general. It was > brought up a while back (and on the PR) of the problems associated with > being able to handle a null-return from error, as compared to a null that > is honestly set. The idea that array-access on null just be ignored. I'm > not sure if this would be seen as the more acceptable implementation which > would remove the need to look-ahead in oplines, as a NULL (error) result > would safely be ignored. > > Thanks > -- > Dave > --94eb2c03f48487056e053b878cd3--