Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96650 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20321 invoked from network); 30 Oct 2016 13:04:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Oct 2016 13:04:36 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.48 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 74.125.82.48 mail-wm0-f48.google.com Received: from [74.125.82.48] ([74.125.82.48:38669] helo=mail-wm0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BE/71-25911-2EFE5185 for ; Sun, 30 Oct 2016 08:04:35 -0500 Received: by mail-wm0-f48.google.com with SMTP id n67so185887864wme.1 for ; Sun, 30 Oct 2016 06:04:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Xk7oCAxdYnMFaBIhoHzMS9TKmcVJfbC9DZhLLOgAnLo=; b=1JPdaqOKmwuEn8cfRP2+EwAPdn5LEjO0fheFhdxId7sfDAJeL6T92Pm2VYSfXIF5zs OQ+YdVYXhcoW81VrSrOk2HlMWyYWQ2RsILCHBg3ktmim5+Do5nhBOD2SzAKL9Ocvth6c yT8vwDAInJgKWgAewAWSCjE6aucBSKwLmnwzoGyD+gAKQOBfTQipMX8nL0oiZLNoLTMu WF29KFvm/jHZBcL4pGqmUwT7Mu18eZ6hjLjTMcXu/u/vZza1G1NqFJ2wj+YIEfCJHn9s YPFAxJiqM8blSmPeIKsrxmn26Rl01PrDHRYIXJ+YzbKTEKomdbomRcix12dLQF0tphWm 42ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Xk7oCAxdYnMFaBIhoHzMS9TKmcVJfbC9DZhLLOgAnLo=; b=T1dPjni9iN+qCddvcKym5aaLNtBepu0uMdhj3fJjooWE9KAKL4+Relh+HN502Bfq1i +L6cpgfZzqI7csDtweDNpsVou4SP6HRagw4jw2a5qMqbzrWB3BcPvu2EmOUA3l1AMyIA 9HQVWGcWedzAYgr3VsNtmiiIfYkDdCX3aLXiCNpsaD8U/n1hPSHDkMWIj4EA6fbGqHAj +dp+zAXj8x7ItUhJkBFsuKXMyvEh9w0dHxKSdX+gc5PdZcqInLkjuDCw6B+WZFz9snIS OiEG4QwHZmXj3AW03V5+jMPvE1+OhfYaHK1sRisdM0EI5velbpJO80nC2tsIIaGcGsRk v92Q== X-Gm-Message-State: ABUngvc5DnZI+3QS7VTCWDe/Gib+S43xzmRbNbYhcXE9bz6+gaqIaOy34O0ymISrIIjqvu7eLlDhnfgYz4glBQ== X-Received: by 10.28.210.195 with SMTP id j186mr7441566wmg.30.1477832672296; Sun, 30 Oct 2016 06:04:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.158.8 with HTTP; Sun, 30 Oct 2016 06:04:31 -0700 (PDT) In-Reply-To: <54d72d8e-d92e-e546-7e20-728c82760a67@librelamp.com> References: <44244cfd-c8ad-e0a9-4e70-380a8a8c940c@syberisle.net> <01f2f3da-592b-fd23-709d-ad620422f56d@fleshgrinder.com> <54d72d8e-d92e-e546-7e20-728c82760a67@librelamp.com> Date: Sun, 30 Oct 2016 14:04:31 +0100 Message-ID: To: Alice Wonder Cc: PHP internals Content-Type: multipart/alternative; boundary=001a11468e147845df054014bb28 Subject: Re: [PHP-DEV] Allow Iterator to be used with current, next, reset, key functions From: nikita.ppv@gmail.com (Nikita Popov) --001a11468e147845df054014bb28 Content-Type: text/plain; charset=UTF-8 On Sun, Oct 30, 2016 at 1:48 PM, Alice Wonder wrote: > On 10/30/2016 05:31 AM, Rasmus Schultz wrote: > >> On second thought, I agree with that - changing reset() and end() >> doesn't make sense, because people know them and expect them to work >> in a certain way. Likely a lot of people would actually continue to >> use them with intermediary variables the way they do today. >> > > Today? > > In PHP 5.6.x I didn't have to use intermediate variables. > You did. You simply suppressed the error in PHP 5. In PHP 7 the error classification changed, so you're no longer suppressing it. See: https://3v4l.org/2R8Vp Prior to the PHP 7 release I suggested marking a number of functions (array_pop/shift, reset, end) as prefer-ref, so they could be used without warning, see http://markmail.org/message/peefyi46iz2amdbq. Nothing really came of it at the time. Just mentioning it here because we can already avoid the warning right now -- we don't have to drop the IAP first. Both issues are independent. However, introducing array_first/last is still better than using reset/end etc, because these functions can easily trigger an unnecessary array copy, while array_first/last wouldn't have that problem. Nikita > > Being required to use them was new with PHP 7 and I suspect you will find > a lot of sites still using pre 7 because they haven't taken the time to > make sure every app they run works in PHP 7. > > All my production servers still run 5.6.x for that reason, I'm only now > starting to port the apps I can now that it appears the PECL modules I need > have finally all been updated. > > The php apps I am fixing are currently littered with code like this: > > > $SEVENFIX = explode('.', $rs[0]->cover); > if(end($SEVENFIX) == "whatever") { > // do stuff > } > > before trying the app in my 7.1.0RCx test servers they worked just fine as > > if(end(explode('.', $rs[0]->cover)) == "whatever") { > // do stuff > } > > So I suppose some people might "continue" to use them with intermediary > but a lot of code that hasn't been ported to 7 doesn't currently. > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a11468e147845df054014bb28--