Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99046 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49071 invoked from network); 15 May 2017 15:21:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 May 2017 15:21:28 -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 74.125.82.44 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 74.125.82.44 mail-wm0-f44.google.com Received: from [74.125.82.44] ([74.125.82.44:37677] helo=mail-wm0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 50/8B-15531-777C9195 for ; Mon, 15 May 2017 11:21:28 -0400 Received: by mail-wm0-f44.google.com with SMTP id d127so80307717wmf.0 for ; Mon, 15 May 2017 08:21:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golemon-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=j706dHwnIZGDIpeEADMNcEvkDo8J48n1QBbKm5WPI8c=; b=jSl6lAPS+Wv69UheeYK/oCGlONLD8o0P6ujsNgSNGAgkwnCTTnV6YCPCJNBbngRgJj j9AlZaVrdMuq2mjj1wmCYbsop+ktn1NK7cNLdc89/hs+WgU2zKJRlqBXN2kwEZ4KtAjv cZ9mCi/8SdpbLI1P8fNSpp5oFeCVjbq6LnAJKcnPTFzSiBkbl6IhmPcFq4qtKMg95FgG hE5oS41lmw8rXqoRcs2dh1BNxOAn4rs66fH+t/FNFbycHgooUaSuImMuZ1V5UW5neZjI 4Uv98bBgvOS04khApTjeLkdbB2n2r+KMV6saiY9qGUAg/RVYGF/9sEexx92H4tD+lpUf spHg== 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:content-transfer-encoding; bh=j706dHwnIZGDIpeEADMNcEvkDo8J48n1QBbKm5WPI8c=; b=SLp/9G/oOfSG/K8bc8Chi7tO0tbiTEPdD+BcSCfWyE2HK6P3bEJmzHMKnif4jl8Z6d a+C7XYb3v+kqWXznbb1LoNeGKjLZqkkVT5MIwddNwsHlPKwWxDmqeA8utELC2a0ON7hg Yg8IX2FetWr1zBbwGbmj9up5wgATXlZN3nBzCaNSFchQ/hjwQgPQP0IN/v4SnQRpZQ3r ILA6WsjnnpAnKjlKHP+p8cGAop+DDljOtKj7TbsuaJwYyAc7mDnIYaa0JYp1/3CldxGI vSIbg27g33mhOO3Gu+0X9QN3Hv0BtembzPPhnv4DWeRi5Ri5nLZ6Lqe2AKOqAlbQGbYY JwkQ== X-Gm-Message-State: AODbwcDvP4OCwZlJkpXijEjf0vGXEjImFDEHSL0JXmvPLhkqQvATs7g6 zILHBeSE2Bug7Nh1gQCch2NwlKOFWw== X-Received: by 10.223.179.199 with SMTP id x7mr5074606wrd.72.1494861683912; Mon, 15 May 2017 08:21:23 -0700 (PDT) MIME-Version: 1.0 Sender: php@golemon.com Received: by 10.223.157.38 with HTTP; Mon, 15 May 2017 08:21:23 -0700 (PDT) X-Originating-IP: [73.9.224.155] In-Reply-To: References: Date: Mon, 15 May 2017 10:21:23 -0500 X-Google-Sender-Auth: ruaWlkKhJ-kLdeTBUFQeM8ZlT8Q Message-ID: To: Nicolas Grekas Cc: Pierre Joye , "internals@lists.php.net" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] BC break in master (7.2) - Distinguish between unmatched subpatterns and empty matches in preg_*() From: pollita@php.net (Sara Golemon) On Mon, May 15, 2017 at 6:36 AM, Nicolas Grekas wrote: >> I agree that a minimum 5 years old possible bug, quite small, causing >> BC breaks is not good. As far as the fix is critical or justified, I >> think it is sometimes ok to break BC for edge cases. However I do not >> see this is not the case here. >> > > Another possibility would be to make this opt-in, with a new flag. > FYI, I quickly spotted at least two places in the code base where we chec= k > the matches with something like: > > if ('' !=3D=3D $matches[2]) {...} else {...} > > This should be a pretty common check so the BC break will impact more > userland code when released. > I agree with the original bug report that being able to distinguish between not-matched and empty-match is a useful and meaningful distinction, and since most users won't care, then the decision to just do it was *probably* right at the time. Given the observation about strict equality checks (which I don't have the data for, but it rings true) it does seem optimistic in *handsight*. Given that, I'd recommend a middle-ground such as the opt-in behavior described here. The extra effort to add that option flag in the rare handful of cases where it matters is miniscule compared to the cost of adjusting equality checks in the myriad places where it doesn't matter, but shows up. My 2 =C2=A2 -Sara