Bug #71581 [Opn]: wrong behaviour when using "." in expression and newline in subject
| From: | kurt at kwnet dot at | Date: | Sat, 13 Feb 2016 08:46:23 +0000 |
| Subject: | Bug #71581 [Opn]: wrong behaviour when using "." in expression and newline in subject | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-199185@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71581&edit=1
ID: 71581
User updated by: kurt at kwnet dot at
Reported by: kurt at kwnet dot at
Summary: wrong behaviour when using "." in expression and
newline in subject
Status: Open
Type: Bug
Package: PCRE related
Operating System: linux ubuntu (apache)
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Sorry, Description should be correct:
Search for "." (any character)...
Previous Comments:
------------------------------------------------------------------------
[2016-02-13 08:45:07] kurt at kwnet dot at
Description:
------------
Search for "," (any character) seems not to include linebreak. => wrong behaviour
Test script:
---------------
//search without newline: correct behaviour
$subject="<tag>Hello World</tag>";
echo
"[".preg_match('/<tag>[A-Za-z\\s]*<\\/tag>/',$subject)."]\n";
//[1]
echo
"[".preg_match('/<tag>[^<]*<\\/tag>/',$subject)."]\n";
//[1]
echo "[".preg_match('/<tag>.*<\\/tag>/',$subject)."]\n";
//[1]
//search with newline: different behaviour on using "."
$subject="<tag>Hello\nWorld</tag>";
echo
"[".preg_match('/<tag>[A-Za-z\\s]*<\\/tag>/',$subject)."]\n";
//[1]
echo
"[".preg_match('/<tag>[^<]*<\\/tag>/',$subject)."]\n";
//[1]
echo "[".preg_match('/<tag>.*<\\/tag>/',$subject)."]\n";
//[0] WRONG RESULT
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71581&edit=1