Bug #81198 [NEW]: preg_match doesn't work properly
| From: | advocat at gmail dot com | Date: | Wed, 23 Jun 2021 19:43:17 +0000 |
| Subject: | Bug #81198 [NEW]: preg_match doesn't work properly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-234605@lists.php.net to get a copy of this message | ||
From: advocat at gmail dot com
Operating system: OSX Big Sur
PHP version: 7.4.20
Package: PCRE related
Bug Type: Bug
Bug description:preg_match doesn't work properly
Description:
------------
From manual page: https://php.net/function.preg-match
---
PHP 7.4.20 (cli) (built: Jun 4 2021 03:32:07) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.20, Copyright (c), by Zend Technologies
Test script:
---------------
$pattern = "#/(?<moduleName>[^/]+)/layout/[^/]*\.xml$#i";
$filename =
"/var/www/project/vendor/magento/theme-frontend-blank/Magento_Theme/layout/default_head_blocks.xml";
var_dump(preg_match($pattern, $filename, $matches), $matches);
$pattern = "#/([^/]+)/layout/[^/]*\.xml$#i";
var_dump(preg_match($pattern, $filename, $matches), $matches);
Expected result:
----------------
int(1)
array(3) {
[0]=>
string(45) "/Magento_Theme/layout/default_head_blocks.xml"
["moduleName"]=>
string(13) "Magento_Theme"
[1]=>
string(13) "Magento_Theme"
}
int(1)
array(2) {
[0]=>
string(45) "/Magento_Theme/layout/default_head_blocks.xml"
[1]=>
string(13) "Magento_Theme"
}
Actual result:
--------------
int(0)
array(0) {
}
int(0)
array(0) {
}
--
Edit bug report at https://bugs.php.net/bug.php?id=81198&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81198&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81198&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81198&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81198&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81198&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81198&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81198&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81198&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81198&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81198&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81198&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81198&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81198&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81198&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81198&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81198&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81198&r=mysqlcfg