Bug #68728 [Asn->Nab]: htmlentities() does not convert ' '/" to /" with ENT_HTML5
Edit report at https://bugs.php.net/bug.php?id=68728&edit=1
ID: 68728
Updated by: cmb@php.net
Reported by: yohgaki@php.net
Summary: htmlentities() does not convert ' '/" to
/" with ENT_HTML5
-Status: Assigned
+Status: Not a bug
Type: Bug
Package: Strings related
Operating System: any
PHP Version: Irrelevant
-Assigned To: yohgaki
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> However, htmlentities() should convert all chars according to
> the conversion table.
No. Quotes and apostophes are handled according to ENT_COMPAT,
ENT_QUOTES and ENT_NOQUOTES, and ENT_HTML5 does not imply
ENT_QUOTES nor ENT_COMPAT, so ENT_NOQUOTES is effective.
This default might not be the best choice, but the behavior is not
a bug, and changing it would require the RFC process because of
the BC break.
Previous Comments:
------------------------------------------------------------------------
[2015-02-11 01:46:03] yohgaki@php.net
I've proposed this change once. I may try it again.
------------------------------------------------------------------------
[2015-02-10 20:47:11] 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-01-03 01:25:53] yohgaki@php.net
Description:
------------
' ' space is   and it's in conversion tables.
localhost:Documents yohgaki$ php -r 'print_r(get_html_translation_table(ENT_HTML5));'
Array
(
["] => "
[&] => &
[<] => <
[>] => >
[Â ] =>
[¡] => ¡
but ' '/" is not converted to /" with htmlentities() at least.
" is converted to " 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:
----------------
" <>?&/
Actual result:
--------------
" <>?&/
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68728&edit=1
Thread (4 messages)