php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71581 wrong behaviour when using "." in expression and newline in subject
Submitted: 2016-02-13 08:45 UTC Modified: 2016-02-13 08:59 UTC
From: kurt at kwnet dot at Assigned:
Status: Not a bug Package: PCRE related
PHP Version: Irrelevant OS: linux ubuntu (apache)
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kurt at kwnet dot at
New email:
PHP Version: OS:

 

 [2016-02-13 08:45 UTC] 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



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-02-13 08:46 UTC] kurt at kwnet dot at
Sorry, Description should be correct:
Search for "." (any character)...
 [2016-02-13 08:59 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2016-02-13 08:59 UTC] requinix@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

http://php.net/manual/en/regexp.reference.dot.php

It's the very first sentence on the page.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 15:01:34 2025 UTC