[prev in list] [next in list] [prev in thread] [next in thread]
List: php-cvs
Subject: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/dom document.c /ext/dom/tests bug43364.phpt
From: "Rob Richards" <rrichards () php ! net>
Date: 2007-11-28 10:45:16
Message-ID: cvsrrichards1196246716 () cvsserver
[Download RAW message or body]
rrichards Wed Nov 28 10:45:16 2007 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/dom/tests bug43364.phpt
Modified files:
/php-src/ext/dom document.c
Log:
MFH: Fix bug #43364 (recursive xincludes don't remove internal nodes properly)
add test
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/document.c?r1=1.68.2.3.2.5&r2=1.68.2.3.2.6&diff_format=u
Index: php-src/ext/dom/document.c
diff -u php-src/ext/dom/document.c:1.68.2.3.2.5 php-src/ext/dom/document.c:1.68.2.3.2.6
--- php-src/ext/dom/document.c:1.68.2.3.2.5 Mon Jan 1 09:36:00 2007
+++ php-src/ext/dom/document.c Wed Nov 28 10:45:16 2007
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: document.c,v 1.68.2.3.2.5 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: document.c,v 1.68.2.3.2.6 2007/11/28 10:45:16 rrichards Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1737,6 +1737,10 @@
/* XML_XINCLUDE_END node will be a sibling of XML_XINCLUDE_START */
while(cur && cur->type != XML_XINCLUDE_END) {
+ /* remove xinclude processing nodes from recursive xincludes */
+ if (cur->type == XML_ELEMENT_NODE) {
+ php_dom_remove_xinclude_nodes(cur->children TSRMLS_CC);
+ }
cur = cur->next;
}
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/tests/bug43364.phpt?view=markup&rev=1.1
Index: php-src/ext/dom/tests/bug43364.phpt
+++ php-src/ext/dom/tests/bug43364.phpt
--TEST--
Bug #43364 (recursive xincludes don't remove internal xml nodes properly)
--FILE--
<?php
function loopElements($nodes)
{
$count = 0;
foreach($nodes as $node) {
if($node instanceof DOMElement) {
$count++;
if($node->childNodes->length > 0) {
$count += loopElements($node->childNodes);
}
}
}
return $count;
}
$xml = <<<DOC
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:xi="http://www.w3.org/2001/XInclude">
<a>
<a_child1>ac1</a_child1>
<a_child2>ac2</a_child2>
</a>
<b><xi:include xpointer="xpointer(/root/a)" /></b>
<c><xi:include xpointer="xpointer(/root/b)" /></c>
</root>
DOC;
$doc = new DomDocument();
$doc->loadXml($xml);
$doc->xinclude();
$count = loopElements(array($doc->documentElement));
var_dump($count);
?>
--EXPECT--
int(13)
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic