php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47433 signature of htmlentities() does only work with all 3 parameters
Submitted: 2009-02-18 07:54 UTC Modified: 2009-02-26 01:00 UTC
Votes:2
Avg. Score:4.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: mbeiser at w-commerce dot de Assigned:
Status: No Feedback Package: Strings related
PHP Version: 5.2.8 OS: Debian Etch
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-02-18 07:54 UTC] mbeiser at w-commerce dot de
Description:
------------
With the PHP Version 5.2.0 there comes a charset-problem concerning the htmlentities-function. While it has worked under PHP4 (setting up the parameters using htaccess), we can't manage to use a htmlentities-function without setting up the charset(UTF-8) with the third parameter. 

This was tested under Debian Etch13, Ubuntu LTS 8.04 with the PHP Versions 5.2.0 and 5.2.8.

Reproduce code:
---------------
<?php

$text = "Text mit Umlauten: ä ü ö";

echo "htmlentities without exp. charset and htaccess:".htmlentities($text, ENT_COMPAT)."\n";
echo "htmlentities utf-8     :".htmlentities($text, ENT_COMPAT, 'utf-8')."\n";

?>

Expected result:
----------------
htmlentities without exp. charset and htaccess: Text mit Umlauten: ä ü ö

htmlentities uf8       : Text mit Umlauten: ä ü ö


Actual result:
--------------
htmlentities without exp. charset and htaccess: Text mit Umlauten: ä ü ö

htmlentities uf8       : Text mit Umlauten: ä ü ö


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-18 21:21 UTC] jani@php.net
Sorry, didn't see the note about 5.2.8 there. Please provide a sane 
reproducing script.
 [2009-02-19 08:21 UTC] mbeiser at w-commerce dot de
Ok, I used the newest version oh php and tested with following script:

<?
        print ini_get('default_charset')."\n";
        print ini_get('mbstring.internal_enconding')."\n";

echo "<pre>\n";

        $text = "text with umlauts: ? ? ?\n";

        echo "t1: ".$text."\n";

        echo "htmlentities           : ".htmlentities($text)."\n";

        echo "htmlentities iso-8859-1: ".htmlentities($text, ENT_COMPAT, 'iso-8859-1')."\n";

        echo "htmlentities uf8       : ".htmlentities($text, ENT_COMPAT,'utf-8')."\n";

echo "</pre>\n";

?>

Still got the same Problem. It only works, when I'm defining the third parameter of the htmlentities-signature the charset explicitly.

I could reproduce this on several servers.
 [2009-02-26 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun May 29 03:03:49 2022 UTC