#46455 [NEW]: htmlentities does not use default_charset or setlocale values
| From: | hostmaster at uuism dot net | Date: | Sat, 01 Nov 2008 17:16:57 +0000 |
| Subject: | #46455 [NEW]: htmlentities does not use default_charset or setlocale values | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-1287@lists.php.net to get a copy of this message | ||
From: hostmaster at uuism dot net
Operating system: Fedora Core 4
PHP version: 5.2CVS-2008-11-01 (snap)
PHP Bug Type: *Languages/Translation
Bug description: htmlentities does not use default_charset or setlocale values
Description:
------------
The function htmlentities() appears to ignore the default_charset value in
the php.ini file or the INI section of test scripts.
I can't find any indication in the PHP Manual that htmlentities() is
supposed to use the value for default_charset.
This problem produces failure in the following tests:
htmlentities() test 10 (default_charset / cp1252)
[ext/standard/tests/strings/htmlentities10.phpt]
htmlentities() test 11 (default_charset / ISO-8859-15)
[ext/standard/tests/strings/htmlentities11.phpt]
htmlentities() test 13 (default_charset / EUC-JP)
[ext/standard/tests/strings/htmlentities13.phpt]
If I change the htmlentities() statement to htmlentities("special
characters", ENT_QUOTES, 'string') where string is cp1252, ISO-8859-15, and
ISO-8859-15, respectively, the tests pass.
The same kind of problem occurs with htmlentities() after the setlocale()
command.
I can't find any indication in the PHP Manual that htmlentities() is
supposed to use the value from the setlocale() command.
This variation of the problem causes these tests to fail:
htmlentities() test 2 (setlocale / fr_FR.ISO-8859-15)
[ext/standard/tests/strings/htmlentities02.phpt] (warn: possibly braind
ead libc)
htmlentities() test 4 (setlocale / ja_JP.EUC-JP)
[ext/standard/tests/strings/htmlentities04.phpt] (warn: possibly braindead
l
ibc)
htmlentities() test 15 (setlocale / KOI8-R)
[ext/standard/tests/strings/htmlentities15.phpt] (warn: possibly braindead
libc)
If I change the htmlentities() statement to htmlentities("special
characters", ENT_QUOTES, 'string') where string is ISO-8859-15, If I change
the htmlentities() statement to htmlentities("special characters",
ENT_QUOTES, 'string') where string is cp1252, ISO-8859-15, and KOI8-R,
respectively, the tests pass.
Reproduce code:
---------------
<?php
$result = (bool)setlocale(LC_CTYPE, "fr_FR.ISO-8859-15",
"fr_FR.ISO8859-15", 'fr_FR@euro');
if (!$result) {
die("skip setlocale() failed\n");
}
echo "warn possibly braindead libc\n";
?>
--INI--
output_handler=
default_charset=
mbstring.internal_encoding=none
--FILE--
<?php
setlocale(LC_CTYPE, "fr_FR.ISO-8859-15", "fr_FR.ISO8859-15",
'fr_FR@euro');
var_dump(htmlentities("\xbc\xbd\xbe", ENT_QUOTES,
'ISO-8859-15'));
?>
Expected result:
----------------
string(20) "ŒœŸ"
Actual result:
--------------
string(24) "¼½¾"
--
Edit bug report at http://bugs.php.net/?id=46455&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46455&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46455&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46455&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46455&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46455&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=46455&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46455&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46455&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46455&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46455&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46455&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=46455&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=46455&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46455&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46455&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46455&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46455&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46455&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46455&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46455&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46455&r=mysqlcfg