php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79846 8c67c166996 broke simple regexp
Submitted: 2020-07-13 11:27 UTC Modified: 2020-07-15 16:44 UTC
From: sjon@php.net Assigned: cmb (profile)
Status: Closed Package: PCRE related
PHP Version: 8.0.0alpha2 OS: archLinux
Private report: No CVE-ID: None
 [2020-07-13 11:27 UTC] sjon@php.net
Description:
------------
I have bisected commit 8c67c166996ae1d6809f0beaf691836e37d6afc1 to fail unexpectedly on a pretty simple regexp, see https://3v4l.org/2vTf0

pcre2test works fine implying a bug in PHP

Test script:
---------------
$item = "component_phase_1";

preg_match("/([a-z]+_[a-z]+_*[a-z]+)_?(\d+)?/", $item, $match);

var_dump($match);

Expected result:
----------------
array(3) {
  [0]=>
  string(17) "component_phase_1"
  [1]=>
  string(15) "component_phase"
  [2]=>
  string(1) "1"
}


Actual result:
--------------
array(0) {
}


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-07-13 12:40 UTC] sjon@php.net
Probably the same issue also caused https://3v4l.org/ejl8v
 [2020-07-13 12:56 UTC] nikic@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: cmb
 [2020-07-13 12:56 UTC] nikic@php.net
Works with -d pcre.jit=0, so presumably a PCRE JIT bug.

I guess that answers our question on whether it's safe to update PCRE on PHP 7.4...
 [2020-07-14 09:35 UTC] cmb@php.net
-Status: Assigned +Status: Verified
 [2020-07-14 09:35 UTC] cmb@php.net
Yes, that appears to be an upstream issue.  I've filed <https://bugs.exim.org/show_bug.cgi?id=2621>.
 [2020-07-14 09:39 UTC] bugreports2 at gmail dot com
> I guess that answers our question on whether it's safe to update PCRE on PHP 7.4

as long as other things like https://bugs.php.net/bug.php?id=79175 are broken you can't win that game unless upstream applies a better QA - guess why Fedora has that much pcre2 patches all the time and they never hit php-rsc
 [2020-07-14 10:34 UTC] cmb@php.net
-Status: Verified +Status: Suspended
 [2020-07-15 16:44 UTC] cmb@php.net
-Status: Suspended +Status: Open
 [2020-07-15 16:44 UTC] cmb@php.net
The upstream bug has been fixed already!
 [2020-07-15 16:47 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #79846: 8c67c166996 broke simple regexp
On GitHub:  https://github.com/php/php-src/pull/5862
Patch:      https://github.com/php/php-src/pull/5862.patch
 [2020-07-16 16:33 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=4659c12ae044154d112aec32d9dcb2ee65db7357
Log: Fix #79846: 8c67c166996 broke simple regexp
 [2020-07-16 16:33 UTC] cmb@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Nov 13 00:01:30 2024 UTC