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
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:
18 - 14 = ?
Subscribe to this entry?

 
 [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: Sat May 04 07:01:31 2024 UTC