Bug #68728 [Com]: htmlentities() does not convert ' '/" to  /" with ENT_HTML5

From: Date: Tue, 10 Feb 2015 20:47:12 +0000
Subject: Bug #68728 [Com]: htmlentities() does not convert ' '/" to  /" with ENT_HTML5
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190570@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68728&edit=1

 ID:                 68728
 Comment by:         ppaisndud at gmail dot com
 Reported by:        yohgaki@php.net
 Summary:            htmlentities() does not convert ' '/" to
                      /" with ENT_HTML5
 Status:             Open
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   any
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[2015-01-03 01:25:53] 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;


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=68728&edit=1


Thread (4 messages)

« previous php.bugs (#190570) next »