php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30786 print_r on a domtext Object
Submitted: 2004-11-14 23:09 UTC Modified: 2004-11-15 03:52 UTC
From: superzouz at hotmail dot com Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 4.3.9 OS: Win XP SP2
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: superzouz at hotmail dot com
New email:
PHP Version: OS:

 

 [2004-11-14 23:09 UTC] superzouz at hotmail dot com
Description:
------------
print_r on a domtext object whose content has been modified will still display the old content.


Reproduce code:
---------------
<pre>
<?php
dl("php_domxml.dll"); //for windows systems only
$oXml = xmldoc('<one><two/><three>blah</three></one>');
$xpresult = xpath_eval(xpath_new_context($oXml), "/one/three");
$var = $xpresult->nodeset[0]->child_nodes();
$var[0]->set_content('hello');
echo($oXml->dump_mem());
print_r($var[0]);
?>
</pre>

Expected result:
----------------
<pre>
<?xml version="1.0"?>
<one><two/><three>hello</three></one>
domtext Object
(
    [type] => 3
    [name] => #text
    [content] => hello
    [0] => 4
    [1] => 6475536
)
</pre>

Actual result:
--------------
<pre>
<?xml version="1.0"?>
<one><two/><three>hello</three></one>
domtext Object
(
    [type] => 3
    [name] => #text
    [content] => blah
    [0] => 4
    [1] => 6475536
)
</pre>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-15 03:52 UTC] chregu@php.net
Don't use print_r or any of the properties in PHP 4 for accessing content of a DomNode... Use the corresponding methods for that.

We will not change that, since it's not easy to do in PHP 4. Upgrade to PHP 5, if you want to access content via properties.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 10:01:29 2024 UTC