Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98809 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90001 invoked from network); 15 Apr 2017 21:14:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Apr 2017 21:14:13 -0000 Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.54 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.214.54 mail-it0-f54.google.com Received: from [209.85.214.54] ([209.85.214.54:32789] helo=mail-it0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CD/32-61625-12D82F85 for ; Sat, 15 Apr 2017 17:14:11 -0400 Received: by mail-it0-f54.google.com with SMTP id 70so1494066ita.0 for ; Sat, 15 Apr 2017 14:14:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=uqpIP5h2S26Dgtt4uNhXSVbNHp0ZYFYZzHj80nTrX2E=; b=i4/E86QSqu7FH3ChyztSONHxfF7y2WCgWaCytvPZ5aqfN0mIJEsFCj35wqfLyY4bPI GSgWOQbePYo43xjt9r4slIANGgZLXlGvPwBAP1QZkoD4EgKduVnmi26DZ7+afP3h/YcO ST+vcCbBkWHmeNv6fIo2Tg+9NA3wOkHM9v0vZGXLYhSDqkeoxMlhhrF2QK2iphu6MV8M kdH6BlFZfT+y/evkcL02V5d6cZXFEwcMlzOiz4TPJphxqHksqU0URecjbn0ZTffKtf3h PYh14+/h0HJb8pe8bFr/QOwREQkfr/nfMNZRKaP8TrY+uDvxvMFBP4gU9gvkGfgdFYa5 /9lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=uqpIP5h2S26Dgtt4uNhXSVbNHp0ZYFYZzHj80nTrX2E=; b=nKG4n2H6wPJs/jH6bPeZLIxA9C8CCelg40GRZU1GBsG4ZPxFVuF0CTmBo6GNKD0OcD Zp/1p71rd9cAAWQ8+jIRsS+HHQMd5G3I7yCQWXpnAh7Vz5cHxj2PUbQm9iuUEyQmRO82 PlFhHKNgcI+UfNEKIr9WM2+RAScRtRScVavBpIfs+JqSPsG9pA/BqEhsDFOtYHlDzm+g wk4Fy1C1CDszTXle6cueKNHndXGWa/0cnWaD5w+T9AJ4h7eYnBV87D/7Sv5MWG9zyU1V 55Ff5YXNHyBtaXrvRp9ukENClHve8Aw8lY7u1VU71QToDfBCaTsShlYMZ7YjEVeBIMBM fCBQ== X-Gm-Message-State: AN3rC/4JcxRk7oSLaDIrLCwnLQ+8zHfw36rAwfj8FZFLjktQS2MI3Pze y0YkkhMpLeCzCI4eeYvURafxiUwU8A== X-Received: by 10.36.76.10 with SMTP id a10mr3299849itb.2.1492290847023; Sat, 15 Apr 2017 14:14:07 -0700 (PDT) MIME-Version: 1.0 Sender: morrison.levi@gmail.com Received: by 10.107.46.199 with HTTP; Sat, 15 Apr 2017 14:14:06 -0700 (PDT) In-Reply-To: <797C79DF-B6A8-4012-8584-26CF816A1278@php.net> References: <797C79DF-B6A8-4012-8584-26CF816A1278@php.net> Date: Sat, 15 Apr 2017 15:14:06 -0600 X-Google-Sender-Auth: t0J2ajbRH0dtk6vuaxTttIVG-Ks Message-ID: To: Derick Rethans Cc: Nikita Popov , PHP Developers Mailing List Content-Type: multipart/alternative; boundary=001a1144820ed6abee054d3b0987 Subject: Re: [PHP-DEV] Re: Inconsistency in line numbers. From: levim@php.net (Levi Morrison) --001a1144820ed6abee054d3b0987 Content-Type: text/plain; charset=UTF-8 On Sat, Apr 15, 2017 at 1:13 PM, Derick Rethans wrote: > On April 15, 2017 5:24:53 PM GMT+01:00, Nikita Popov > wrote: > >On Sat, Apr 15, 2017 at 5:25 PM, Derick Rethans wrote: > > > >> Hi Nikita, > >> > >> Through Xdebug bug #1413 (https://bugs.xdebug.org/view.php?id=1413), > >I > >> noticed > >> that behaviour with class constants changed between PHP 7.1.3 and PHP > >> 7.1.4. > >> I *believe* it is because of the fix for issue #69676 > >> (https://bugs.php.net/bug.php?id=69676) that got fixed in PHP 7.1.4. > >> > >> With OPcache loaded, the INIT_ARRAY and further opcodes are relisted > >as > >> being > >> on line 15 instead of line 17. Although, I would probably argue that > >> INIT_ARRAY should really be on line 13 (the opening [). > >> > >> Without OPcache loaded, in PHP 7.1.3, FETCH_CLASS_CONSTANT is on line > >15, > >> and > >> the INIT_ARRAY and further opcodes are on line 17. In PHP 7.1.4, they > >are > >> all > >> on line 15 - with 17 no longer showing up. > >> > >> I believe, the behaviour with and without OPcache should be the same, > >and I > >> would argue that the correct result would need to be that > >> FETCH_CLASS_CONSTANT > >> (if still present, OPcache optimises it out) should be on line 15, > >the > >> INIT_ARRAY on line 13, and the SEND_VAL_EX and further, are on line > >17. > >> > >> Code > >> ==== > >> > >> 1 >> 2 > >> 3 namespace ICanBoogie\Validate\Validator; > >> 4 > >> 5 class Required2 > >> 6 { > >> 7 const ALIAS = 'required'; > >> 8 const DEFAULT_MESSAGE = "is required"; > >> 9 const OPTION_STOP_ON_ERROR = 'stop_on_error'; > >> 10 > >> 11 public function normalize_params(array $params) > >> 12 { > >> 13 return array_merge([ > >> 14 > >> 15 self::OPTION_STOP_ON_ERROR => true > >> 16 > >> 17 ], $params); > >> 18 } > >> 19 } > >> > >> > >> PHP 7.1.3 (no OPcache) > >> ====================== > >> > >> filename: /tmp/xdebug-bug-1/lib/Required2.php > >> function name: normalize_params > >> number of ops: 14 > >> compiled vars: !0 = $params > >> line #* E I O op fetch ext > >return > >> operands > >> ------------------------------------------------------------ > >> ------------------------- > >> 11 0 E > EXT_NOP > >> 1 RECV !0 > >> 13 2 EXT_STMT > >> 3 INIT_NS_FCALL_BY_NAME > >> 4 EXT_FCALL_BEGIN > >> 15 5 FETCH_CLASS_CONSTANT ~1 > >> 'OPTION_STOP_ON_ERROR' > >> 17 6 INIT_ARRAY ~2 > >> , ~1 > >> 7 SEND_VAL_EX > >> ~2 > >> 8 SEND_VAR_EX > >> !0 > >> 9 DO_FCALL_BY_NAME > >> 10 EXT_FCALL_END > >> 11 > RETURN > >> $3 > >> 18 12* EXT_STMT > >> 13* > RETURN > >> null > >> > >> > >> PHP 7.1.3 (OPcache) > >> ====================== > >> > >> filename: /tmp/xdebug-bug-1/lib/Required2.php > >> function name: normalize_params > >> number of ops: 11 > >> compiled vars: !0 = $params > >> line #* E I O op fetch ext > >return > >> operands > >> ------------------------------------------------------------ > >> ------------------------- > >> 11 0 E > EXT_NOP > >> 1 RECV !0 > >> 13 2 EXT_STMT > >> 3 INIT_NS_FCALL_BY_NAME > >> 4 EXT_FCALL_BEGIN > >> 17 5 INIT_ARRAY ~1 > >> , 'stop_on_error' > >> 6 SEND_VAL_EX > >> ~1 > >> 7 SEND_VAR_EX > >> !0 > >> 8 DO_FCALL 0 $1 > >> 9 EXT_FCALL_END > >> 10 > RETURN > >> $1 > >> > >> > >> PHP 7.1.4 (no OPcache) > >> ====================== > >> > >> filename: /tmp/xdebug-bug-1/lib/Required2.php > >> function name: normalize_params > >> number of ops: 14 > >> compiled vars: !0 = $params > >> line #* E I O op fetch ext > >return > >> operands > >> ------------------------------------------------------------ > >> ------------------------- > >> 11 0 E > EXT_NOP > >> 1 RECV !0 > >> 13 2 EXT_STMT > >> 3 INIT_NS_FCALL_BY_NAME > >> 4 EXT_FCALL_BEGIN > >> 15 5 FETCH_CLASS_CONSTANT ~1 > >> 'OPTION_STOP_ON_ERROR' > >> 6 INIT_ARRAY ~2 > >> , ~1 > >> 7 SEND_VAL_EX > >> ~2 > >> 8 SEND_VAR_EX > >> !0 > >> 9 DO_FCALL_BY_NAME > >> 10 EXT_FCALL_END > >> 11 > RETURN > >> $3 > >> 18 12* EXT_STMT > >> 13* > RETURN > >> null > >> > >> > >> PHP 7.1.4 (OPcache) > >> ====================== > >> > >> filename: /tmp/xdebug-bug-1/lib/Required2.php > >> function name: normalize_params > >> number of ops: 11 > >> compiled vars: !0 = $params > >> line #* E I O op fetch ext > >return > >> operands > >> ------------------------------------------------------------ > >> ------------------------- > >> 11 0 E > EXT_NOP > >> 1 RECV !0 > >> 13 2 EXT_STMT > >> 3 INIT_NS_FCALL_BY_NAME > >> 4 EXT_FCALL_BEGIN > >> 15 5 INIT_ARRAY ~1 > >> , 'stop_on_error' > >> 6 SEND_VAL_EX > >> ~1 > >> 7 SEND_VAR_EX > >> !0 > >> 8 DO_FCALL 0 $1 > >> 9 EXT_FCALL_END > >> 10 > RETURN > >> $1 > >> > >> cheers, > >> Derick > >> > > > >This is due to > >https://github.com/php/php-src/commit/183cd048f18fa4b04fb30448a84a54 > cee80a2491, > >which fixed lineno assignment for list AST nodes. This changed the > >start > >lineno of the array from line 17 (the end of the array) to line 15 (the > >first array element). Of course this is still inaccurate (the actual > >start > >line is 13), but it's the closest we can get with the information we > >currently have available. > > > >The problem in this case is that the second SEND_VAR_EX did not bump > >the > >lineno. I've fixed this in > >https://github.com/php/php-src/commit/e433c23b96e81340cd0e2d0b4b7f5f > ce7f72a931 > >. > > > >This required a change to an existing test, which alerted me to some > >weird > >behavior I wasn't aware of: https://3v4l.org/6fSRb In backtraces the > >call > >is located on the line of it's last argument (in PHP 5.6 the line of > >the > >closing ")"). Wouldn't it make more sense to use the starting line of > >the > >call? That is, use the same lineno for INIT_FCALL and DO_FCALL? > > > >Nikita > > It makes sense to me to use the first line, as long as further opcodes > will have the right line number. > I agree the first line makes sense. > Selfishly, I'd prefer if that change was only made for master, due to the > increasingly complex tests I need to make for Xdebug's code coverage. That means it will go into 7.2 and not into any 7.1 fix, correct? --001a1144820ed6abee054d3b0987--