#37601 [NoF->Opn]: SimpleXML and loss of entities
| From: | php at nineberry dot de | Date: | Wed, 19 Mar 2008 13:36:57 +0000 |
| Subject: | #37601 [NoF->Opn]: SimpleXML and loss of entities | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-123471@lists.php.net to get a copy of this message | ||
ID: 37601
User updated by: php at nineberry dot de
Reported By: php at nineberry dot de
-Status: No Feedback
+Status: Open
Bug Type: SimpleXML related
Operating System: probably irrelevant
PHP Version: 5.1.4
New Comment:
No longer reproducable in PHP 5.2.5
So this was fixed sometime between 5.1.4 and 5.2.5
Previous Comments:
------------------------------------------------------------------------
[2006-06-03 01:00:01] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2006-05-26 22:07:44] helly@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
------------------------------------------------------------------------
[2006-05-26 12:12:25] php at nineberry dot de
Description:
------------
When assigning values to node parameters, entities are not escaped,
however when reading values, the entities are replaced by their
meaning.
i.e. assigning and reading behave assymetric.
Suggestion: Add escaping of values that are assigned.
Kind of workaround: Use htmlspecialchars() manually on values before
assigning. (This workaround will not work for ')
Reproduce code:
---------------
<?php
$rawxml = '<root par="F" />';
$test = 'A " B';
$rr = simplexml_load_string($rawxml);
header("Content-Type: text/plain");
echo($rr["par"]);
echo("\n");
echo("\n");
$rr["par"] = $test;
echo($rr->asXML());
echo("\n");
echo($rr["par"]);
echo("\n");
?>
Expected result:
----------------
F
<?xml version="1.0"?>
<root par="A "quot; B"/>
A " B
Actual result:
--------------
F
<?xml version="1.0"?>
<root par="A " B"/>
A " B
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37601&edit=1