php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35943 DOMNode->nodeValue expects xml instead of simple string
Submitted: 2006-01-09 14:05 UTC Modified: 2006-01-09 15:45 UTC
From: php at jesperkristensen dot dk Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.1.1 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: php at jesperkristensen dot dk
New email:
PHP Version: OS:

 

 [2006-01-09 14:05 UTC] php at jesperkristensen dot dk
Description:
------------
DOMNode->nodeValue expects an xml-string. If a string containing an &-character in inputet, only the string be fore that character will be saved. If the string containg a xml entity, the &-character wille not be substituted with its entity but simply be written into the file. This thing worked as expected in PHP 5.0.x

Reproduce code:
---------------
// In the example $myNode a DOMNode object, created from the following piece of xml: <node></node>

$myNode->nodeValue = "Me & You";
// Actual xml file: <node>Me </node>
// Expected xml file: <node>Me &amp; You</node>

$myNode->nodeValue ="Me &amp; You";
// Actual xml file: <node>Me &amp; You</node>
// Expected xml file: <node>Me &amp;amp; You</node>

$val = $myNode->nodeValue;
// Works as expected

$myNode->nodeValue = $myNode->nodeValue;
// This will change the content of <node>, if it contains "&"


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-09 15:45 UTC] 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

It has always worked this way using a DOMElement node (double checked 5.0.2 thru 5.1.2RC2). Only way to get your expected results is when using the actual DOMText node.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 16 08:01:33 2024 UTC