php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48230 xml_utf8_decode incorrectly decode
Submitted: 2009-05-11 02:41 UTC Modified: 2009-05-11 13:08 UTC
From: root at 80sec dot com Assigned:
Status: Not a bug Package: XML related
PHP Version: 5.2.9 OS: Linux/win
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: root at 80sec dot com
New email:
PHP Version: OS:

 

 [2009-05-11 02:41 UTC] root at 80sec dot com
Description:
------------
xml_utf8_decode function incorrectly decode.

Reproduce code:
---------------
<?php
$ill=chr(0xf0).chr(0xc0).chr(0xc0).chr(0xa7);
$ill=addslashes($ill);
echo utf8_decode("$ill");
echo htmlspecialchars ($ill,ENT_QUOTES,"utf-8" );
?>

Expected result:
----------------
it will output a "'" incorrectly.

Actual result:
--------------
it will output a "'" incorrectly.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-11 09:27 UTC] jani@php.net
RTFM:
"This function decodes data , assumed to be UTF-8 encoded, to ISO-8859-
1."
 [2009-05-11 12:24 UTC] root at 80sec dot com
chr(0xf0).chr(0xc0).chr(0xc0).chr(0xa7)

is not a valid utf8 data.
 [2009-05-11 13:08 UTC] derick@php.net
We know it is not, but the function only works on proper UTF-8 like is documented. So there is no bug here, the bug is on your code calling this function. You can't require functions to work like they're not meant to work—but that's what you're asking here.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 00:01:28 2024 UTC