Bug #77567 [Opn->Nab]: \s don't cache a html decoded
| From: | nikic@php.net | Date: | Mon, 04 Feb 2019 16:14:30 +0000 |
| Subject: | Bug #77567 [Opn->Nab]: \s don't cache a html decoded | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-219363@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77567&edit=1
ID: 77567
Updated by: nikic@php.net
Reported by: thibaud at 42stores dot com
Summary: \s don't cache a html decoded
-Status: Open
+Status: Not a bug
Type: Bug
Package: PCRE related
Operating System: Ubuntu 18.04
PHP Version: 7.2.14
Block user comment: N
Private report: N
New Comment:
You are missing the /u modifier, to treat the string as UTF-8 and enable UCP mode:
var_dump(preg_replace('/\s+/u','!',html_entity_decode(' ')));
Previous Comments:
------------------------------------------------------------------------
[2019-02-04 15:15:14] thibaud at 42stores dot com
Description:
------------
---
From manual page: https://php.net/function.html-entity-decode
---
\s meta-character in regular expression don't cache the character resulting of a
html_entity_decode of a string containing " " (using utf-8).
Test script:
---------------
var_dump(preg_replace('/\s+/','!',html_entity_decode(' ')));
Expected result:
----------------
string(1) "!"
Actual result:
--------------
string(2) " "
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77567&edit=1