Bug #71581 [NEW]: wrong behaviour when using "." in expression and newline in subject

From: Date: Sat, 13 Feb 2016 08:45:10 +0000
Subject: Bug #71581 [NEW]: wrong behaviour when using "." in expression and newline in subject
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199184@lists.php.net to get a copy of this message
From: kurt at kwnet dot at Operating system: linux ubuntu (apache) PHP version: Irrelevant Package: PCRE related Bug Type: Bug Bug description:wrong behaviour when using "." in expression and newline in subject 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 bug report at https://bugs.php.net/bug.php?id=71581&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71581&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71581&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71581&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=71581&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=71581&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=71581&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=71581&r=needscript Try newer version: https://bugs.php.net/fix.php?id=71581&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=71581&r=support Expected behavior: https://bugs.php.net/fix.php?id=71581&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=71581&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=71581&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=71581&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71581&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=71581&r=dst IIS Stability: https://bugs.php.net/fix.php?id=71581&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=71581&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=71581&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=71581&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=71581&r=mysqlcfg

« previous php.bugs (#199184) next »