php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38424 different by attribute-assignment if new attribute or old attribute
Submitted: 2006-08-11 11:12 UTC Modified: 2006-08-14 12:02 UTC
From: milman at gmx dot de Assigned:
Status: Closed Package: SimpleXML related
PHP Version: 5.1.4 OS: WindowsXP
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:
22 + 43 = ?
Subscribe to this entry?

 
 [2006-08-11 11:12 UTC] 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" ;
?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-14 12:02 UTC] rrichards@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 12:01:27 2024 UTC