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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 14:01:34 2025 UTC