php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77567 \s don't cache a   html decoded
Submitted: 2019-02-04 15:15 UTC Modified: 2019-02-04 16:14 UTC
From: thibaud at 42stores dot com Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 7.2.14 OS: Ubuntu 18.04
Private report: No CVE-ID: None
 [2019-02-04 15:15 UTC] 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) " "

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-02-04 16:14 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2019-02-04 16:14 UTC] nikic@php.net
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(' ')));
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC