Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99058 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41244 invoked from network); 16 May 2017 10:51:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 May 2017 10:51:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=nicolas.grekas@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nicolas.grekas@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.49 as permitted sender) X-PHP-List-Original-Sender: nicolas.grekas@gmail.com X-Host-Fingerprint: 209.85.214.49 mail-it0-f49.google.com Received: from [209.85.214.49] ([209.85.214.49:36653] helo=mail-it0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D1/62-15531-FB9DA195 for ; Tue, 16 May 2017 06:51:43 -0400 Received: by mail-it0-f49.google.com with SMTP id o5so59508372ith.1 for ; Tue, 16 May 2017 03:51:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=XZBR5gifwA1n2Rr1n1Cp+/xtXeGCrIhmNGz2Qcyu5lU=; b=grnne6lU6zOTOiiyz6I8XH4iwyxfVpdsaXbw+IAnmxlPutcHTWah6cJjX8EpT3fUxo PRftUwfSD1XZlz+sbYiGAfJcoICZFN48GlGV3Gb+mbtsiYfMWljl/lClHegGIuHGGjSF xTtAeW6lqQt4u+mDwdUcGiqMNgnjk/ZnFOdZyYmPBrG44IROjipL0Vk0UGQDIAsN6+hg t4jYIvIOPisHOm/h/IP2Z+kiRmBB4v9KcIi4zK2uVsQmEIX2aYpua9162aEn9S3Zu0wP Xs1FWgK5skzg8tuwR4GJd+Kbcs05PC+tJ2oc+Pxs6jPwzCg8Zs3cn7FhuP7V/udeY2ih 73Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=XZBR5gifwA1n2Rr1n1Cp+/xtXeGCrIhmNGz2Qcyu5lU=; b=UbeMCy5Ztb/ARo9osWLcUajxzReKC2E7zh9SkWXVgCba1KyRUsKPfLZnKcBBGgcs7Y PKlWA+TuU7LwGOg7Xg6OSdoclpM8NbL1AU+MvfR2S0OXK84jqP7U3Q+W7isl8vYc9WY7 tzYgmqC+IEbumG03OdjYwyHkdSh5FIS3JVlKaJ+0IKE3d6OlJHUrT1oTEBHAa7ql2D3j /vjODiZDCcJKwJf9Z6BEiB3MDSezIT607ipdee/CfP2gepzdriwlKPz4Yn+JHpF2GP8O AB6+n3hVyerfopQQ6x1UGXGivuyYo0VKMszC7S9kWktaYLeI66o0ef+Gz+TAUugRwCQd RZ2Q== X-Gm-Message-State: AODbwcAsPs84XxYi9yeBPsGWL0lQZK7wWyct976A187R2i5ZmmeyXXXH BfcOnZc/1eg75IWITnuBErYKXU9cpg== X-Received: by 10.36.53.143 with SMTP id k137mr10680523ita.102.1494931900786; Tue, 16 May 2017 03:51:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.130.201 with HTTP; Tue, 16 May 2017 03:51:20 -0700 (PDT) In-Reply-To: References: Date: Tue, 16 May 2017 12:51:20 +0200 Message-ID: To: Sara Golemon , Remi Collet , "Christoph M. Becker" Cc: Pierre Joye , "internals@lists.php.net" Content-Type: multipart/alternative; boundary="001a114a9bbae8f034054fa1f474" Subject: Re: [PHP-DEV] BC break in master (7.2) - Distinguish between unmatched subpatterns and empty matches in preg_*() From: nicolas.grekas@gmail.com (Nicolas Grekas) --001a114a9bbae8f034054fa1f474 Content-Type: text/plain; charset="UTF-8" 2017-05-15 17:21 GMT+02:00 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 > check > > the matches with something like: > > > > if ('' !== $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. Here is a PR implementing the new flag: https://github.com/php/php-src/pull/2526 Nicolas --001a114a9bbae8f034054fa1f474--