php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61801 Problem in htmlentities()
Submitted: 2012-04-21 20:10 UTC Modified: 2012-04-21 20:41 UTC
From: lucas dot bocchi at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.4.0 OS: Linux Debian wheezy/sid
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: lucas dot bocchi at gmail dot com
New email:
PHP Version: OS:

 

 [2012-04-21 20:10 UTC] lucas dot bocchi at gmail dot com
Description:
------------
The first call of htmlentities works OK, but, the next call always return a empty string. When I print_r($res), all values are printed OK

Test script:
---------------
mysql_connect($db_host,$db_user,$db_pass);
mysql_select_db($database);
$sql = "select noticia_id,noticia_datacad,noticia_assunto,noticia_titulo from tab_noticia order by noticia_data desc,categoria_id desc,noticia_id desc limit 15;";
$qry = mysql_query($sql);
$res = mysql_fetch_row($qry);
while ($res) {
        $title = htmlentities($res[3]);
        $subject = htmlentities($res[2]);
        $data = $res[1];
        echo "\t\t\t\t\t<item>\r\n";
        echo "\t\t\t\t\t\t<title>".$titulo."</title>\r\n";
        echo "\t\t\t\t\t\t<description>".$assunto."</description>\r\n";
        echo "\t\t\t\t\t\t<lastBuildDate>".$data."</lastBuildDate>\r\n";
        echo "\t\t\t\t\t\t<link>http://www.the.site/news.php?id=".$id."</link>\r\n";
        echo "\t\t\t\t\t</item>\r\n";
        $res = mysql_fetch_row($qry);
} // end while
mysql_close();


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-21 20:41 UTC] cataphract@php.net
-Status: Open +Status: Not a bug
 [2012-04-21 20:41 UTC] cataphract@php.net
Almost surely caused by change of default encoding to UTF-8 and the not being in UTF-8. To have pre-5.4 behavior set the encoding parameter to 'ISO-8859-1'.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 27 07:00:02 2025 UTC