htmlentities returns nothing
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
php5 (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
The html function returns an empty string or maybe null when a latin1 encoded string is provided.
<?php
print htmlentities(
print htmlentites(
?>
This happened in Ubuntu 12.10b2 32-bit, and it does not happen in ubuntu 12.04
For the moment, the solution is to specify the encoding:
<? htmlentities(
ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: php5 5.4.6-1ubuntu1
ProcVersionSign
Uname: Linux 3.5.0-15-generic i686
NonfreeKernelMo
ApportVersion: 2.5.3-0ubuntu1
Architecture: i386
Date: Sat Sep 29 10:05:39 2012
InstallationMedia: Ubuntu 12.10 "Quantal Quetzal" - Beta i386 (20120926)
PackageArchitec
ProcEnviron:
LANGUAGE=es_PE:es
TERM=xterm
PATH=(custom, no user)
LANG=es_PE.UTF-8
SHELL=/bin/bash
SourcePackage: php5
UpgradeStatus: No upgrade log present (probably fresh install)
Thank you for taking the time to report this bug and helping to make Ubuntu better.
From the manual at http:// php.net/ manual/ en/function. htmlentities. php:
htmlentities() takes an optional third argument encoding which defines encoding used in conversion. If omitted, the default value for this argument is ISO-8859-1 in versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards. Although this argument is technically optional, you are highly encouraged to specify the correct value for your code.
As the default encoding is documented to have changed between 5.3.10 (12.04) and 5.4.6 (12.10), my understanding of the manual is that what you're seeing is expected, and if you want to decode ISO-8859-1 then you are required to specify your encoding as you have described.
Since this appears to be expected behaviour and not a bug, I'm marking this bug as Invalid. If this is wrong, please do comment and reopen.