php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68728 htmlentities() does not convert ' '/" to  /" with ENT_HTML5
Submitted: 2015-01-03 01:25 UTC Modified: 2015-02-11 01:46 UTC
From: yohgaki@php.net Assigned: yohgaki (profile)
Status: Assigned Package: Unknown/Other Function
PHP Version: Irrelevant OS: any
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-01-03 01:25 UTC] yohgaki@php.net
Description:
------------
' ' space is &nbsp and it's in conversion tables.

localhost:Documents yohgaki$ php -r 'print_r(get_html_translation_table(ENT_HTML5));'
Array
(
    ["] => "
    [&] => &
    [<] => &lt;
    [>] => &gt;
    [ ] => &nbsp;
    [¡] => &iexcl;

but ' '/" is not converted to &nbsp;/&quot; with htmlentities() at least.
" is converted to &quot; with additional ENT_QUOTES flag. However, htmlentities() should convert all chars according to the conversion table.


Test script:
---------------
php -r 'echo htmlentities("\" <>?&/", ENT_HTML5);'


Expected result:
----------------
&quot;&nbsp;&lt;&gt;&quest;&amp;&sol;

Actual result:
--------------
" &lt;&gt;&quest;&amp;&sol;

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-02-10 20:47 UTC] ppaisndud at gmail dot com
This line causes this,

https://github.com/php/php-src/blob/master/ext/standard/html.c#L1316-L1318

probably can be moved to verified if it is a error.
 [2015-02-11 01:46 UTC] yohgaki@php.net
-Assigned To: +Assigned To: yohgaki
 [2015-02-11 01:46 UTC] yohgaki@php.net
I've proposed this change once. I may try it again.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC