ID:               37601
 Updated by:       [EMAIL PROTECTED]
 Reported By:      php at nineberry dot de
-Status:           Open
+Status:           Feedback
 Bug Type:         SimpleXML related
 Operating System: probably irrelevant
 PHP Version:      5.1.4
 New Comment:

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


Previous Comments:
------------------------------------------------------------------------

[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 &quot; 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;quot; B"/>

A &quot; B

Actual result:
--------------
F

<?xml version="1.0"?>
<root par="A &quot; B"/>

A " B


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=37601&edit=1

Reply via email to