Bug #81198 [Opn->Fbk]: preg_match doesn't work properly

From: Date: Wed, 23 Jun 2021 20:11:29 +0000
Subject: Bug #81198 [Opn->Fbk]: preg_match doesn't work properly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234608@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81198&edit=1 ID: 81198 Updated by: requinix@php.net Reported by: advocat at gmail dot com Summary: preg_match doesn't work properly -Status: Open +Status: Feedback Type: Bug Package: PCRE related Operating System: OSX Big Sur PHP Version: 7.4.20 Block user comment: N Private report: N New Comment: Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. https://3v4l.org/4YDGj If you've tried *that exact code* and it isn't working, - What version of PCRE2 do you have? - What if you disable JIT with pcre.jit=0? Previous Comments: ------------------------------------------------------------------------ [2021-06-23 20:10:39] danack@php.net Please try disabling pcre.jit with ini_set("pcre.jit", "0") possibly dupe of https://bugs.php.net/bug.php?id=81185 ------------------------------------------------------------------------ [2021-06-23 19:43:17] advocat at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=81198&edit=1

« previous php.bugs (#234608) next »