php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81505 preg_match BC after apt-get upgrade
Submitted: 2021-10-05 10:16 UTC Modified: 2021-10-05 14:50 UTC
From: php at tim dot ainfach dot de Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 8.0.11 OS: OSX 10.14.6
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php at tim dot ainfach dot de
New email:
PHP Version: OS:

 

 [2021-10-05 10:16 UTC] php at tim dot ainfach dot de
Description:
------------
We have noticed that a test failed in our CI process. I guess its a BC in preg_match.

I am not 100% sure if it's related to php / ubuntu or ppa:ondrej/php but i guess a lot of people are affected by this. We could also reproduce this issue on different servers and containers.

you can reproduce the issue in with docker. The only difference here is the apt-get upgrade. foo.php is the example script.



docker run --rm -v "`pwd`/foo.php:/foo.php" -it ubuntu:latest \
   /bin/bash -c 'apt-get update && apt-get install software-properties-common -y && add-apt-repository ppa:ondrej/php && apt-get update && apt-get install -y php8.0-cli && php -v &&  php /foo.php'

# array(3) {
#   [0]=>
#   string(19) "/348182/XXX_348102/"
#   [1]=>
#   string(6) "348182"
#   [2]=>
#   string(6) "348102"
# }

echo "now with upgrade"

# array(0) {
# }

docker run --rm -v "`pwd`/foo.php:/foo.php" -it ubuntu:latest \
   /bin/bash -c 'apt-get update && apt-get install software-properties-common -y && add-apt-repository ppa:ondrej/php && apt-get update && apt-get upgrade && apt-get install -y php8.0-cli && php -v &&  php /foo.php'




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

preg_match('/\/([\d]+)\/XXX_([\d]+)\//', '00/348/348182/XXX_348102/xxx', $matches); var_dump($matches);

Expected result:
----------------
array(3) {
  [0]=>
  string(19) "/348182/XXX_348102/"
  [1]=>
  string(6) "348182"
  [2]=>
  string(6) "348102"
}

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-10-05 10:18 UTC] php at tim dot ainfach dot dq
here is the complete output when running the command:

https://gist.github.com/timglabisch/75683af0250262a556cd0d694414a742
 [2021-10-05 10:30 UTC] php at tim dot ainfach dot de
i crossposted this bug here: 
https://github.com/oerdnj/deb.sury.org/issues/1653

i guess it's related to one of these packages:
libargon2-1 libidn2-0 libpcre2-8-0 libpcre3 libxml2 libzstd1
 [2021-10-05 11:45 UTC] php at tim dot ainfach dot de
-Status: Open +Status: Closed
 [2021-10-05 11:45 UTC] php at tim dot ainfach dot de
resolved: https://github.com/oerdnj/deb.sury.org/issues/1653
 [2021-10-05 14:50 UTC] requinix@php.net
-Status: Closed +Status: Not a bug -Package: *Regular Expressions +Package: PCRE related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 20:01:29 2024 UTC