php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #78312 Different results between 7.3.7 and 7.4
Submitted: 2019-07-19 12:41 UTC Modified: 2019-08-06 11:20 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: oleg at andreyev dot lv Assigned:
Status: Verified Package: PCRE related
PHP Version: 7.4Git-2019-07-19 (Git) OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: oleg at andreyev dot lv
New email:
PHP Version: OS:

 

 [2019-07-19 12:41 UTC] oleg at andreyev dot lv
Description:
------------
When running `preg_match_all` on 7.3.7 and 7.4 getting different results on

Test script:
---------------
https://3v4l.org/lvdlR

Expected result:
----------------
-

Actual result:
--------------
-

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-07-19 12:48 UTC] danack@php.net
To avoid confusion, on PHP <7.4 the output is:
array(15) {
  [0]=>
  string(0) ""
  [1]=>
  string(0) ""
  [2]=>
  string(0) ""
  [3]=>
  string(0) ""
  [4]=>
  string(0) ""
  [5]=>
  string(0) ""
  [6]=>
  string(0) ""
  [7]=>
  string(0) ""
  [8]=>
  string(0) ""
  [9]=>
  string(0) ""
  [10]=>
  string(0) ""
  [11]=>
  string(0) ""
  [12]=>
  string(0) ""
  [13]=>
  string(0) ""
  [14]=>
  string(0) ""
}

Output on > 7.4

array(15) {
  [0]=>
  array(2) {
    [0]=>
    string(0) ""
    [1]=>
    int(-1)
  }
  [1]=>
  array(2) {
    [0]=>
    string(0) ""
    [1]=>
    int(-1)
  }
  [2]=>
  array(2) {
    [0]=>
    string(0) ""
    [1]=>
    int(-1)
  }
  [3]=>
  array(2) {
    [0]=>
    string(0) ""
    [1]=>
    int(-1)
  }
  [4]=>
  array(2) {
    [0]=>
    string(0) ""
    [1]=>
    int(-1)
  }
  [5]=>
  array(2) {
    [0]=>
    string(0) ""
    [1]=>
    int(-1)
  }
  [6]=>
  array(2) {
    [0]=>
    string(0) ""
    [1]=>
    int(-1)
  }
  [7]=>
  array(2) {
    [0]=>
    string(0) ""
    [1]=>
    int(-1)
  }
  [8]=>
  array(2) {
    [0]=>
    string(0) ""
    [1]=>
    int(-1)
  }
  [9]=>
  array(2) {
    [0]=>
    string(0) ""
    [1]=>
    int(-1)
  }
  [10]=>
  array(2) {
    [0]=>
    string(0) ""
    [1]=>
    int(-1)
  }
  [11]=>
  array(2) {
    [0]=>
    string(0) ""
    [1]=>
    int(-1)
  }
  [12]=>
  array(2) {
    [0]=>
    string(0) ""
    [1]=>
    int(-1)
  }
  [13]=>
  array(2) {
    [0]=>
    string(0) ""
    [1]=>
    int(-1)
  }
  [14]=>
  array(2) {
    [0]=>
    string(0) ""
    [1]=>
    int(-1)
  }
}
 [2019-07-19 12:59 UTC] sjon@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: sjon
 [2019-07-19 12:59 UTC] sjon@php.net
Actually the output in 7.4 seems to be correct as before the offset was completely missing. This was fixed in Bug #73948

also - the output in 7.4 actually matches the documentation better - don't you agree?
 [2019-07-19 14:12 UTC] requinix@php.net
-Package: *Regular Expressions +Package: PCRE related
 [2019-07-19 14:12 UTC] requinix@php.net
What's more, this is mentioned by NEWS and UPGRADING so it's not like this change has been forgotten...
 [2019-07-19 14:41 UTC] oleg at andreyev dot lv
-Status: Feedback +Status: Assigned
 [2019-07-19 14:41 UTC] oleg at andreyev dot lv
This is something that I would like to see highlighted because it can affect all templating engines who has some Lexers e.g.: Twig
 [2019-07-19 14:44 UTC] requinix@php.net
-Status: Assigned +Status: Feedback
 [2019-07-19 14:44 UTC] requinix@php.net
It will be documented in the function's Changelog and the 7.4 migration guide. That is how these sorts of changes are always handled. Anyone blindly upgrading their codebase to 7.4, or any new version series, is shooting themselves in the foot.

Is that acceptable? If not then what are you asking for to happen?
 [2019-07-19 15:53 UTC] nikic@php.net
This specific case doesn't seem to be mentioned in UPGRADING (it currently only discusses the UNMATCHED_AS_NULL case), so that at least should be added.
 [2019-07-19 17:38 UTC] oleg at andreyev dot lv
-Status: Feedback +Status: Assigned
 [2019-07-19 17:38 UTC] oleg at andreyev dot lv
As Nikita mentioned only UNMATCHED_AS_NULL is covered and OFFSET_CAPTURE was missed (probably other cases are also missed)
 [2019-08-06 11:20 UTC] sjon@php.net
-Status: Assigned +Status: Verified -Assigned To: sjon +Assigned To:
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 17:01:30 2024 UTC