rrichards               Fri Mar 13 13:43:29 2009 UTC

  Added files:                 (Branch: PHP_5_3)
    /php-src/ext/dom/tests      bug47430.phpt 

  Modified files:              
    /php-src/ext/dom    attr.c document.c node.c 
  Log:
  MFB: fix bug #47430 (Errors after writing to nodeValue parameter of an absent 
previousSibling)
  add test
  
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/attr.c?r1=1.18.2.2.2.2.2.11&r2=1.18.2.2.2.2.2.12&diff_format=u
Index: php-src/ext/dom/attr.c
diff -u php-src/ext/dom/attr.c:1.18.2.2.2.2.2.11 
php-src/ext/dom/attr.c:1.18.2.2.2.2.2.12
--- php-src/ext/dom/attr.c:1.18.2.2.2.2.2.11    Wed Dec 31 11:15:36 2008
+++ php-src/ext/dom/attr.c      Fri Mar 13 13:43:29 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: attr.c,v 1.18.2.2.2.2.2.11 2008/12/31 11:15:36 sebastian Exp $ */
+/* $Id: attr.c,v 1.18.2.2.2.2.2.12 2009/03/13 13:43:29 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -220,13 +220,14 @@
                return FAILURE;
        }
 
+       ALLOC_ZVAL(*retval);
+
        nodeparent = nodep->parent;
        if (!nodeparent) {
-               return FAILURE;
+               ZVAL_NULL(*retval);
+               return SUCCESS;
        }
 
-       ALLOC_ZVAL(*retval);
-
        if (NULL == (*retval = php_dom_create_object(nodeparent, &ret, NULL, 
*retval, obj TSRMLS_CC))) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING,  "Cannot create 
required DOM object");
                return FAILURE;
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/document.c?r1=1.68.2.3.2.5.2.14&r2=1.68.2.3.2.5.2.15&diff_format=u
Index: php-src/ext/dom/document.c
diff -u php-src/ext/dom/document.c:1.68.2.3.2.5.2.14 
php-src/ext/dom/document.c:1.68.2.3.2.5.2.15
--- php-src/ext/dom/document.c:1.68.2.3.2.5.2.14        Mon Jan 26 19:10:53 2009
+++ php-src/ext/dom/document.c  Fri Mar 13 13:43:29 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: document.c,v 1.68.2.3.2.5.2.14 2009/01/26 19:10:53 rrichards Exp $ */
+/* $Id: document.c,v 1.68.2.3.2.5.2.15 2009/03/13 13:43:29 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -251,12 +251,14 @@
                return FAILURE;
        }
 
+       ALLOC_ZVAL(*retval);
+
        dtdptr = xmlGetIntSubset(docp);
        if (!dtdptr) {
-               return FAILURE;
+               ZVAL_NULL(*retval);
+               return SUCCESS;
        }
 
-       ALLOC_ZVAL(*retval);
        if (NULL == (*retval = php_dom_create_object((xmlNodePtr) dtdptr, &ret, 
NULL, *retval, obj TSRMLS_CC))) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create 
required DOM object");
                return FAILURE;
@@ -299,12 +301,14 @@
                return FAILURE;
        }
 
+       ALLOC_ZVAL(*retval);
+
        root = xmlDocGetRootElement(docp);
        if (!root) {
-               return FAILURE;
+               ZVAL_NULL(*retval);
+               return SUCCESS;
        }
 
-       ALLOC_ZVAL(*retval);
        if (NULL == (*retval = php_dom_create_object(root, &ret, NULL, *retval, 
obj TSRMLS_CC))) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create 
required DOM object");
                return FAILURE;
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/node.c?r1=1.37.2.3.2.8.2.13&r2=1.37.2.3.2.8.2.14&diff_format=u
Index: php-src/ext/dom/node.c
diff -u php-src/ext/dom/node.c:1.37.2.3.2.8.2.13 
php-src/ext/dom/node.c:1.37.2.3.2.8.2.14
--- php-src/ext/dom/node.c:1.37.2.3.2.8.2.13    Tue Jan 13 18:06:48 2009
+++ php-src/ext/dom/node.c      Fri Mar 13 13:43:29 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: node.c,v 1.37.2.3.2.8.2.13 2009/01/13 18:06:48 rrichards Exp $ */
+/* $Id: node.c,v 1.37.2.3.2.8.2.14 2009/03/13 13:43:29 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -260,7 +260,6 @@
                        break;
                default:
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid 
Node Type");
-                       return FAILURE;
        }
 
        ALLOC_ZVAL(*retval);
@@ -422,13 +421,14 @@
                return FAILURE;
        }
 
+       ALLOC_ZVAL(*retval);
+
        nodeparent = nodep->parent;
        if (!nodeparent) {
-               return FAILURE;
+               ZVAL_NULL(*retval);
+               return SUCCESS;
        }
 
-       ALLOC_ZVAL(*retval);
-
        if (NULL == (*retval = php_dom_create_object(nodeparent, &ret, NULL, 
*retval, obj TSRMLS_CC))) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create 
required DOM object");
                return FAILURE;
@@ -491,12 +491,13 @@
                first = nodep->children;
        }
 
+       ALLOC_ZVAL(*retval);
+
        if (!first) {
-               return FAILURE;
+               ZVAL_NULL(*retval);
+               return SUCCESS;
        }
 
-       ALLOC_ZVAL(*retval);
-
        if (NULL == (*retval = php_dom_create_object(first, &ret, NULL, 
*retval, obj TSRMLS_CC))) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create 
required DOM object");
                return FAILURE;
@@ -527,12 +528,13 @@
                last = nodep->last;
        }
 
+       ALLOC_ZVAL(*retval);
+
        if (!last) {
-               return FAILURE;
+               ZVAL_NULL(*retval);
+               return SUCCESS;
        }
 
-       ALLOC_ZVAL(*retval);
-
        if (NULL == (*retval = php_dom_create_object(last, &ret, NULL, *retval, 
obj TSRMLS_CC))) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create 
required DOM object");
                return FAILURE;
@@ -559,13 +561,14 @@
                return FAILURE;
        }
 
+       ALLOC_ZVAL(*retval);
+
        prevsib = nodep->prev;
        if (!prevsib) {
-               return FAILURE;
+               ZVAL_NULL(*retval);
+               return SUCCESS;
        }
 
-       ALLOC_ZVAL(*retval);
-
        if (NULL == (*retval = php_dom_create_object(prevsib, &ret, NULL, 
*retval, obj TSRMLS_CC))) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create 
required DOM object");
                return FAILURE;

http://cvs.php.net/viewvc.cgi/php-src/ext/dom/tests/bug47430.phpt?view=markup&rev=1.1
Index: php-src/ext/dom/tests/bug47430.phpt
+++ php-src/ext/dom/tests/bug47430.phpt



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

Reply via email to