#38823 [Bgs]: DOMComment->appendData does nothing

From: Date: Thu, 14 Sep 2006 13:02:37 +0000
Subject: #38823 [Bgs]: DOMComment->appendData does nothing
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-102181@lists.php.net to get a copy of this message
ID: 38823 Updated by: tony2001@php.net Reported By: ladislav dot prosek at matfyz dot cz Status: Bogus Bug Type: DOM XML related Operating System: Windows XP SP2 Pro PHP Version: 5.1.6 New Comment: Yes, please report it to libxml2 developers. Previous Comments: ------------------------------------------------------------------------ [2006-09-14 12:57:02] ladislav dot prosek at matfyz dot cz If you replace $x->appendData("b") with $x->insertData(1, "b"), it will produce the expected output. Clearly it is a bug, in PHP or libxml2 (and definitely not bogus). If you're convinced that it's not in PHP, then someone should report it to libxml2. Will you do it or should I? ------------------------------------------------------------------------ [2006-09-14 12:51:05] tony2001@php.net Tell that to libxml2 authors? tree.c: .... int xmlTextConcat(xmlNodePtr node, const xmlChar *content, int len) { if (node == NULL) return(-1); if ((node->type != XML_TEXT_NODE) && (node->type != XML_CDATA_SECTION_NODE)) { #ifdef DEBUG_TREE xmlGenericError(xmlGenericErrorContext, "xmlTextConcat: node is not text nor CDATA\n"); #endif return(-1); } .... ------------------------------------------------------------------------ [2006-09-14 12:47:40] ladislav dot prosek at matfyz dot cz Your XML is a bit rusty, isn't it? :)) Of course they do have data. What do you think is the string that you pass to createComment? ------------------------------------------------------------------------ [2006-09-14 12:42:51] tony2001@php.net Comments do not have data, only text and cdata nodes have it. ------------------------------------------------------------------------ [2006-09-14 10:17:08] ladislav dot prosek at matfyz dot cz Description: ------------ Calling appendData() on a DOMComment seems to have zero effect on the comment. Reproduce code: --------------- <? $doc = new DOMDocument; $x = $doc->createComment("a"); $x->appendData("b"); echo $x->nodeValue; ?> Expected result: ---------------- ab Actual result: -------------- a ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38823&edit=1

« previous php.bugs (#102181) next »