Bug #81060 [Nab]: The expression does not compile correctly
| From: | vklimin at 510710 dot com | Date: | Thu, 20 May 2021 17:17:55 +0000 |
| Subject: | Bug #81060 [Nab]: The expression does not compile correctly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-233927@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81060&edit=1
ID: 81060
User updated by: vklimin at 510710 dot com
Reported by: vklimin at 510710 dot com
Summary: The expression does not compile correctly
Status: Not a bug
Type: Bug
Package: PCRE related
Operating System: Debian 10
PHP Version: 8.0.6
Block user comment: N
Private report: N
New Comment:
The proposed solution is not correct
var_dump( preg_match( '/\Q\/\E/', '/' ) );
Expected result:
----------------
int(1)
Actual result:
--------------
int(0)
Previous Comments:
------------------------------------------------------------------------
[2021-05-20 17:14:01] imsop@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
The first character of the regex determines the delimiter; any extra instances of that delimiter
need to be escaped.
var_dump( preg_match( '/\Q\/\E/', '/' ) );
------------------------------------------------------------------------
[2021-05-20 17:09:51] vklimin at 510710 dot com
Changed the name of the corresponding package
------------------------------------------------------------------------
[2021-05-20 17:07:16] vklimin at 510710 dot com
Description:
------------
The expression does not compile correctly and generates a warning.
Test script:
---------------
var_dump( preg_match( '#\Q/\E#', '/' ) );
var_dump( preg_match( '/\Q/\E/', '/' ) );
Expected result:
----------------
int(1)
int(1)
Actual result:
--------------
int(1)
Warning: preg_match(): Unknown modifier '\' in [...][...] on line 1
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81060&edit=1