rrichards               Sat Sep 16 13:56:25 2006 UTC

  Modified files:              
    /php-src/ext/dom    characterdata.c node.c 
    /php-src/ext/dom/tests      bug38850.phpt 
  Log:
  MFB: implement workaround for bug #38823 (DOMComment->appendData does nothing)
  fix bug #38850 (lookupNamespaceURI doesn't return default namespace)
  add test
  
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/characterdata.c?r1=1.19&r2=1.20&diff_format=u
Index: php-src/ext/dom/characterdata.c
diff -u php-src/ext/dom/characterdata.c:1.19 
php-src/ext/dom/characterdata.c:1.20
--- php-src/ext/dom/characterdata.c:1.19        Fri Aug  4 18:11:27 2006
+++ php-src/ext/dom/characterdata.c     Sat Sep 16 13:56:25 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: characterdata.c,v 1.19 2006/08/04 18:11:27 rrichards Exp $ */
+/* $Id: characterdata.c,v 1.20 2006/09/16 13:56:25 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -207,9 +207,19 @@
        }
 
        DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
-
+#if LIBXML_VERSION < 20627
+/* Implement logic from libxml xmlTextConcat to add suport for comments and PI 
*/
+    if ((nodep->content == (xmlChar *) &(nodep->properties)) ||
+        ((nodep->doc != NULL) && (nodep->doc->dict != NULL) &&
+               xmlDictOwns(nodep->doc->dict, nodep->content))) {
+       nodep->content = xmlStrncatNew(nodep->content, arg, arg_len);
+    } else {
+        nodep->content = xmlStrncat(nodep->content, arg, arg_len);
+    }
+    nodep->properties = NULL;
+#else
        xmlTextConcat(nodep, arg, arg_len);
-
+#endif
        RETURN_TRUE;
 }
 /* }}} end dom_characterdata_append_data */
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/node.c?r1=1.49&r2=1.50&diff_format=u
Index: php-src/ext/dom/node.c
diff -u php-src/ext/dom/node.c:1.49 php-src/ext/dom/node.c:1.50
--- php-src/ext/dom/node.c:1.49 Tue Aug  8 16:59:10 2006
+++ php-src/ext/dom/node.c      Sat Sep 16 13:56:25 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: node.c,v 1.49 2006/08/08 16:59:10 tony2001 Exp $ */
+/* $Id: node.c,v 1.50 2006/09/16 13:56:25 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1611,20 +1611,18 @@
        dom_object *intern;
        xmlNsPtr nsptr;
        int prefix_len = 0;
-       char *prefix;
+       char *prefix=NULL;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&", &id, dom_node_class_entry, &prefix, &prefix_len, UG(utf8_conv)) == 
FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os!&", &id, dom_node_class_entry, &prefix, &prefix_len, UG(utf8_conv)) == 
FAILURE) {
                return;
        }
 
        DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
 
-       if (prefix_len > 0) {
-               nsptr = xmlSearchNs(nodep->doc, nodep, prefix);
-               if (nsptr && nsptr->href != NULL) {
-                       RETVAL_XML_STRING((char *) nsptr->href, ZSTR_DUPLICATE);
-                       return;
-               }
+       nsptr = xmlSearchNs(nodep->doc, nodep, prefix);
+       if (nsptr && nsptr->href != NULL) {
+               RETVAL_XML_STRING((char *) nsptr->href, ZSTR_DUPLICATE);
+               return;
        }
 
        RETURN_NULL();
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/tests/bug38850.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/dom/tests/bug38850.phpt
diff -u /dev/null php-src/ext/dom/tests/bug38850.phpt:1.2
--- /dev/null   Sat Sep 16 13:56:25 2006
+++ php-src/ext/dom/tests/bug38850.phpt Sat Sep 16 13:56:25 2006
@@ -0,0 +1,22 @@
+--TEST--
+Bug # 38850 (lookupNamespaceURI does not return default namespace)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$xml = b<<<HERE
+<?xml version="1.0" ?>
+<foo xmlns="http://www.example.com/ns/foo"; />
+HERE;
+
+$doc = new DOMDocument();
+$doc->loadXML($xml);
+
+$root = $doc->documentElement;
+
+print $root->lookupNamespaceURI(NULL);
+
+
+?>
+--EXPECT--
+http://www.example.com/ns/foo

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to