php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31208 XML Parser can't handle htmlspecialchars
Submitted: 2004-12-20 18:37 UTC Modified: 2004-12-20 20:39 UTC
From: taavi at meos dot ee Assigned:
Status: Not a bug Package: *XML functions
PHP Version: 5.0.3 OS: Linux 2.6.9
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
44 + 44 = ?
Subscribe to this entry?

 
 [2004-12-20 18:37 UTC] taavi at meos dot ee
Description:
------------
XML file contains html: <a href="hello">tere</a> which is encoded and sent as $data to parsing function:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<lahendus>
   <L>1</L>
   <lNimetus>Baaslahendus</lNimetus>
   <lKirjeldus>Minu seaded, kasutajakontod, s?steemi seaded</lKirjeldus>
   <lVersioon>2.0.0</lVersioon>
   <lMemo>&lt;a href=&quot;hello&quot;&gt;tere&lt;/a&gt;</lMemo>
</lahendus>



Reproduce code:
---------------
... /* more code here, not that important now */

$parser = xml_parser_create('ISO-8859-1');
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING,'ISO-8859-1');
xml_parse_into_struct($parser, $data, $values, $tags);

... /* more code here, not that important now */

$xml = new tmc_xml;
$asjad = $xml->loe_andmed('lahendus.xml','lahendus');
echo $asjad[0]['lMemo'];

Expected result:
----------------
<a href="hello">tere</a>

Actual result:
--------------
/*
  nothing here, only: <html><body></body></html>

  Some remarks: this code works perfectly in php 5.0.2
  So, i unlinked php 5.0.3 and recompiled php 5.0.2 with same
  options - no problems - acts as expected:
*/

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-20 20:39 UTC] rrichards@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

see bug #31139 which was already fixed in cvs
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Jan 20 09:03:33 2022 UTC