#30786 [Opn->Bgs]: print_r on a domtext Object

From: Date: Mon, 15 Nov 2004 02:52:49 +0000
Subject: #30786 [Opn->Bgs]: print_r on a domtext Object
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-69059@lists.php.net to get a copy of this message
ID: 30786 Updated by: chregu@php.net Reported By: superzouz at hotmail dot com -Status: Open +Status: Bogus Bug Type: DOM XML related Operating System: Win XP SP2 PHP Version: 4.3.9 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2004-11-14 23:09:02] 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> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30786&edit=1

« previous php.bugs (#69059) next »