Doc #62341 [NEW]: htmlspecialchars() should work on ascii compatible encodings by default.
From: bfanger at gmail dot com
Operating system:
PHP version: 5.4.4
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:htmlspecialchars() should work on ascii compatible encodings by default.
Description:
------------
In PHP 5.4 the default encoding for htmlentities is changed to 'UTF-8',
When a ISO-8859-1 encoded string with a special character is passed to the
htmlspecialchars() it returns an empty string (invalid mutlibyte sequence)
This is the new intended (and more secure) behavior, and i agree, but...
The old default (ISO-8859-1) worked on both UTF-8, ISO-8859-1 and other
ascii
compatible encodings, which is reflected in the documentation:
"Calling htmlspecialchars() is sufficient if the encoding supports all
characters
in the input string (such us UTF-8 but also ISO-8859-1 on ISO-8859-1 only
input).
htmlentities() needs to be called only if the output encoding doesn't
support all
characters in the input string."
This is no longer the case, unless ENT_IGNORE is passed.
Solution:
Drop the paragraph from the documentation.
PS:
You might wan't to add a paragraph that incorrect encoded text will cause
htmlspecialschars() to return an empty string.
--
Edit bug report at https://bugs.php.net/bug.php?id=62341&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62341&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62341&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62341&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=62341&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62341&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=62341&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=62341&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=62341&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=62341&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=62341&r=support
Expected behavior: https://bugs.php.net/fix.php?id=62341&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=62341&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=62341&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=62341&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62341&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62341&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=62341&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=62341&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=62341&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=62341&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=62341&r=mysqlcfg
Thread (2 messages)
- bfanger at gmail dot com