php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74612 A backreference to a branch reset group
Submitted: 2017-05-18 14:58 UTC Modified: 2019-03-18 16:59 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: oleynikovny at mail dot ru Assigned:
Status: Open Package: PCRE related
PHP Version: 7.1.5 OS: GNU/Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-05-18 14:58 UTC] oleynikovny at mail dot ru
Description:
------------
A backreference to a branch reset group works as expected in PHP 5 but not in PHP 7.

Test script:
---------------
<?php

$string = '--';

$doesNotMatchInPhp7 = '/(?|(---)|(-))\1$/';
$matchesInPhp7 = '/(?|(-)|(---))\1$/';

var_dump(preg_match($doesNotMatchInPhp7, $string));
var_dump(preg_match($matchesInPhp7, $string));



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-05-18 14:59 UTC] oleynikovny at mail dot ru
-Summary: Usage of a back reference to a branch reset group +Summary: A back reference to a branch reset group
 [2017-05-18 14:59 UTC] oleynikovny at mail dot ru
Adjusted a summary.
 [2017-05-18 15:02 UTC] oleynikovny at mail dot ru
-Summary: A back reference to a branch reset group +Summary: A backreference to a branch reset group
 [2017-05-18 15:02 UTC] oleynikovny at mail dot ru
Adjusted a summary.
 [2017-05-18 16:05 UTC] requinix@php.net
https://3v4l.org/J6L3u

Works without JIT. https://3v4l.org/7dAic

Upstream bug?
 [2019-03-18 16:59 UTC] nikic@php.net
Looks like this got fixed in PHP 7.3 due to the update to PCRE2.

It looks like there also was a new PCRE1 release recently, but I'm not seeing this issue in the changelog.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 02:01:25 2019 UTC