#39973 [Bgs]: Handling of & in XML file. Running php 5.1.2
ID: 39973
User updated by: l dot chemwolo at heinosoft dot eu
Reported By: l dot chemwolo at heinosoft dot eu
Status: Bogus
Bug Type: XML related
Operating System: Ubuntu
PHP Version: 5CVS-2006-12-28 (snap)
New Comment:
Thanks for the hint. I will try and find the solution.
Previous Comments:
------------------------------------------------------------------------
[2006-12-28 20:56:34] rrichards@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
char data can be chunked so do not expect it all at once
------------------------------------------------------------------------
[2006-12-28 12:44:41] tony2001@php.net
Please "a short but complete example script max. 10-20 lines long"
which does not include non-existing files etc.
------------------------------------------------------------------------
[2006-12-28 12:41:26] l dot chemwolo at heinosoft dot eu
It gives the following as the result:
Bill
&
John Keen
It seems to take the tag <builder>Bill & John Keen</builder> to be
containing three cdata sections within it. Therefore the '&' overwrites
the 'Bill' and the 'John Keen' overwrites the 'Bill' and finally I
have
'John Keen' as the cdata value for this tag; making it seem like it
dropped the ampersand and anything before it.
------------------------------------------------------------------------
[2006-12-28 12:33:32] l dot chemwolo at heinosoft dot eu
Reproduce code:
---------------
<?php
require_once 'Parser.php';
class CluistraParser extends XML_Parser{
function cdataHandler($parser, $data)
{
$data=trim($data);
echo $data."<br/>";
}
}
$cluistra=new CluistraParser();
$cluistra->setInputFile("afile.xml");
$success = $cluistra->parse();
if (PEAR::isError($success)) {
die('Parsing failed: '.$success->getMessage());
}
/*afile.xml has:
<?xml version='1.0' encoding='ISO-8859-1'?>
<builder>Bill & John Keen</builder>*/
?>
------------------------------------------------------------------------
[2006-12-28 10:03:34] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/39973
--
Edit this bug report at http://bugs.php.net/?id=39973&edit=1
Thread (10 messages)