php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #45865 incorrect values returned by htmlspecialchars_decode
Submitted: 2008-08-19 23:46 UTC Modified: 2008-08-19 23:56 UTC
From: firealwaysworks at gmail dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.2.6 OS: Linux
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: firealwaysworks at gmail dot com
New email:
PHP Version: OS:

 

 [2008-08-19 23:46 UTC] firealwaysworks at gmail dot com
Description:
------------
As I understand it htmlspecialchars_decode is the inverse of htmlspecialchars.  The bug is that not all characters are inverted properly.

Thanks,
Michael 

Reproduce code:
---------------
<?php
echo "\n".htmlspecialchars_decode(htmlspecialchars("'",ENT_QUOTES));
echo "\n".htmlspecialchars_decode(htmlspecialchars('"',ENT_QUOTES));
?>

Expected result:
----------------
'
"

Actual result:
--------------
&#039;
"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-19 23:56 UTC] felipe@php.net
There is no some bug in this behavior.
Read: http://docs.php.net/htmlspecialchars_decode

Thanks.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 30 01:00:02 2025 UTC