#38424 [Ver->Csd]: different by attribute-assignment if new attribute or old attribute
| From: | rrichards@php.net | Date: | Mon, 14 Aug 2006 12:02:06 +0000 |
| Subject: | #38424 [Ver->Csd]: different by attribute-assignment if new attribute or old attribute | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-100761@lists.php.net to get a copy of this message | ||
ID: 38424
Updated by: rrichards@php.net
Reported By: milman at gmx dot de
-Status: Verified
+Status: Closed
Bug Type: SimpleXML related
Operating System: WindowsXP
PHP Version: 5.1.4
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2006-08-11 11:12:25] milman at gmx dot de
Description:
------------
if you make an assignmet to an attribute and the value you assign has
special chars, it makes a difference if the attribute is new or not.
the best way would be if there was no need for the htmlspecialchars
function call.
Reproduce code:
---------------
<?php
echo "<body>\n" ;
error_reporting(E_ALL | E_STRICT) ;
$xml = simplexml_load_string('<xml></xml>');
$str = "abc & def" ;
$xml["a1"] = "" ;
$xml["a1"] = htmlspecialchars($str,ENT_NOQUOTES) ;
$xml["a2"] = htmlspecialchars($str,ENT_NOQUOTES) ;
$xml["a3"] = "" ;
$xml["a3"] = $str ;
$xml["a4"] = $str ;
echo "<xmp>\n" ;
echo "str: $str \n" ;
echo "a1: correct: {$xml["a1"]} \n" ;
echo "a2: wrong: {$xml["a2"]} \n" ;
echo "a3: wrong: {$xml["a3"]} \n" ;
echo "a4: correct: {$xml["a4"]} \n" ;
echo $xml->asXML() ;
echo "</xmp>\n" ;
echo "</body>\n" ;
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38424&edit=1