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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: thibaud at 42stores dot com
New email:
PHP Version: OS:

 

 [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-2022 The PHP Group
All rights reserved.
Last updated: Sat Jan 29 02:03:33 2022 UTC