#23531 [NEW]: Can't reset internal treenode to correctly reread xml document
| From: | bharris at spro dot net | Date: | Wed, 07 May 2003 18:02:04 +0000 |
| Subject: | #23531 [NEW]: Can't reset internal treenode to correctly reread xml document | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-39238@lists.php.net to get a copy of this message | ||
From: bharris at spro dot net
Operating system: Red Hat 8.0
PHP version: 4.3.2RC2
PHP Bug Type: DOM XML related
Bug description: Can't reset internal treenode to correctly reread xml document
--SCRIPT--
$xmlstr = '<?xml
version="1.0"?><configuration><datasources><subtree
name="Test"><apply-template
name="test.xml.com"/></subtree></datasources></configuration>';
$dom = domxml_open_mem($xmlstr);
$root = $dom->document_element();
$element = 0;
transversenodes($root, 'first');
$dom->free();
$dom = domxml_open_mem($xmlstr);
$root = $dom->document_element();
$element = 0;
transversenodes($root, 'second');
nice_r($_SESSION);
function transversenodes (&$node, $string) {
global $element;
if ($node->has_child_nodes()) {
$child = $node->child_nodes();
for ($i = 0; $i < count($child); $i++) {
if ($child[$i]->node_type() == XML_ELEMENT_NODE) {
if ($child[$i]->tagname == 'apply-template') {
$_SESSION[$string][$element] = $child[$i];
$element++;
break;
}
if ($child[$i]->tagname == 'subtree') {
$_SESSION[$string][$element] = $child[$i];
$element++;
}
transversenodes($child[$i], $string);
}
}
}
}
function nice_r (&$variable) {
echo "<pre>\n";
print_r($variable);
echo "</pre>\n";
}
--MODULES--
'./configure' '--host=i386-redhat-linux' '--build=i386-redhat-linux'
'--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr'
'--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin'
'--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include'
'--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var'
'--sharedstatedir=/usr/com' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--prefix=/usr'
'--with-config-file-path=/etc'
'--enable-force-cgi-redirect' '--disable-debug' '--enable-pic'
'--disable-rpath' '--enable-inline-optimization' '--with-bz2'
'--with-curl' '--with-dom=/usr' '--with-exec-dir=/usr/bin'
'--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd'
'--enable-gd-native-ttf' '--with-ttf' '--with-gdbm'
'--with-gettext'
'--with-ncurses' '--with-gmp' '--with-iconv'
'--with-jpeg-dir=/usr'
'--with-openssl' '--with-png' '--with-pspell' '--with-xml'
'--with-expat-dir=/usr' '--with-zlib' '--with-layout=GNU'
'--enable-bcmath' '--enable-exif' '--enable-ftp'
'--enable-magic-quotes'
'--enable-safe-mode' '--enable-sockets' '--enable-sysvsem'
'--enable-sysvshm' '--enable-discard-path' '--enable-track-vars'
'--enable-trans-sid' '--enable-yp' '--enable-wddx'
'--without-oci8'
'--with-pear=/usr/share/pear' '--with-imap=shared' '--with-imap-ssl'
'--with-kerberos=/usr/kerberos' '--with-ldap=shared'
'--with-mysql=shared,/usr' '--with-pgsql=shared'
'--with-snmp=shared,/usr'
'--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared'
'--enable-memory-limit' '--enable-bcmath' '--enable-shmop'
'--enable-versioning' '--enable-calendar' '--enable-dbx'
'--enable-dio'
'--enable-mcal' '--with-apxs2=/usr/sbin/apxs'
--COMMENTS--
I appologize for the length of the test script but I couldn't trim it any
more to show my point
My problem is that I can't reset the internal namespace for DOMXML
documents unless I load a new page (i.e. can't reset the dom space within
a single script). I need to have access to functions that will do
whatever is done between page loads because that successfully resets the
internal treenode pointer. I need to be able to load a document into an
internal treenode, modify it, write it to file then display a graphical
hyperlinked representation of the modified treenode on the same "page".
Without being able to reset the internal treenode my serialized objects
don't point at the correct object on the next page and I get an error.
Reclicking the same hyperlink at this point works because ending the
script the first time resets the internal treenode correctly. I thought
$dom->free() would work but it appears it's not, if you run my script
you'll see that the object id's are different for the second dom object
even though it's the same document, just reloaded.
--
Edit bug report at http://bugs.php.net/?id=23531&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=23531&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=23531&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=23531&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=23531&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=23531&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=23531&r=support
Expected behavior: http://bugs.php.net/fix.php?id=23531&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=23531&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=23531&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=23531&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23531&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=23531&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=23531&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=23531&r=gnused