php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60675 htmlentities(ENT_COMPAT, windows-1251) for ISO-8859-1 encoded scripts
Submitted: 2012-01-06 21:58 UTC Modified: 2012-01-07 13:12 UTC
From: danielc@php.net Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.4SVN-2012-01-06 (SVN) OS: ubuntu 10.0.4 / lucid
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: danielc@php.net
New email:
PHP Version: OS:

 

 [2012-01-06 21:58 UTC] danielc@php.net
Description:
------------
The behavior htmlentities() (or PHP's parser/whatever) has changed between 5.3 and 5.4.  I will put a phpt file in svn once the bug number is known.

Test script:
---------------
$in = 'Òåñòèðóåì';
echo htmlentities($in, ENT_COMPAT, 'windows-1251');


Expected result:
----------------
Тестируем

Actual result:
--------------
illegible

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-01-06 22:08 UTC] danielc@php.net
Automatic comment from SVN on behalf of danielc
Revision: http://svn.php.net/viewvc/?view=revision&revision=321840
Log: Test for bug 60675.
 [2012-01-06 22:09 UTC] danielc@php.net
Automatic comment from SVN on behalf of danielc
Revision: http://svn.php.net/viewvc/?view=revision&revision=321841
Log: Test for bug 60675.
 [2012-01-06 22:11 UTC] danielc@php.net
The test script is in PHP_5_4 and trunk as
ext/standard/tests/strings/bug60675.phpt
 [2012-01-07 13:12 UTC] cataphract@php.net
-Status: Open +Status: Bogus
 [2012-01-07 13:12 UTC] cataphract@php.net
htmlentities replaces characters with their *named* entities, for those characters that have it, with the exception of ' (apos):

«This function is identical to htmlspecialchars() in all ways, except with htmlentities(), *all characters which have HTML character entity equivalents* are translated into these entities.» (doc for htmlentities(), emphasis mine)

It is true that, for some encodings, htmlentities used to provide numerical entities for some characters. I removed such functionality because 1) it's inconsistent with the other encodings and 2) it was never documented behavior.

Please remove the failing test you've added.

Thanks!
 [2012-01-07 23:09 UTC] danielc@php.net
Automatic comment from SVN on behalf of danielc
Revision: http://svn.php.net/viewvc/?view=revision&revision=321887
Log: Remove test for bug 60675, the change in behavior between 5.3 and 5.4 is intentional.
 [2012-01-07 23:27 UTC] danielc@php.net
Automatic comment from SVN on behalf of danielc
Revision: http://svn.php.net/viewvc/?view=revision&revision=321892
Log: Skip entities test in PHP 5.4 due to changes noted in PHP Bug 60675.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 21:01:31 2025 UTC