php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50106 htmlspecialchars is inconsistent with the specification
Submitted: 2009-11-06 21:37 UTC Modified: 2009-11-09 17:12 UTC
From: bugzilla33 at gmail dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 5.3.1RC3 OS: All
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bugzilla33 at gmail dot com
New email:
PHP Version: OS:

 

 [2009-11-06 21:37 UTC] bugzilla33 at gmail dot com
Description:
------------
When use HTML 5 widt <!DOCTYPE html>
we must encode only widt &#xx;
It is not supported entity like: &amp;&quot; etc

When mime type is application/xhtml+xml and <!DOCTYPE html>
browser halt xml parsing on &amp;&quot; etc

http://pl.php.net/manual/en/function.htmlspecialchars.php
http://pl.php.net/manual/en/function.htmlentities.php

Reproduce code:
---------------
<?=htmlspecialchars('&')?>

Expected result:
----------------
'&' (ampersand) becomes '&#38;' 
'"' (double quote) becomes '&#34;'
''' (single quote) becomes '&#39;' 
'<' (less than) becomes '&#60;' 
'>' (greater than) becomes '&#62;'

Actual result:
--------------
'&' (ampersand) becomes '&amp;' 
'"' (double quote) becomes '&quot;' 
''' (single quote) becomes '&#039;' 
'<' (less than) becomes '&lt;' 
'>' (greater than) becomes '&gt;'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-09 17:12 UTC] jani@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 [2011-04-01 13:54 UTC] technik at thomas-heuer dot eu
Well, if this is not a bug, please turn into a feature-request.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 09:01:28 2024 UTC