sterling                Fri Jul  4 17:58:09 2003 EDT

  Modified files:              
    /php-src/ext/simplexml      simplexml.c 
  Log:
  fix memory cverrun when accessing an empty xml element.
  guess how many lines it took me to write a basic WSDL parser + API?  20 using
  curl + simplexml
  
  
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.47 php-src/ext/simplexml/simplexml.c:1.48
--- php-src/ext/simplexml/simplexml.c:1.47      Mon Jun 30 20:49:25 2003
+++ php-src/ext/simplexml/simplexml.c   Fri Jul  4 17:58:09 2003
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: simplexml.c,v 1.47 2003/07/01 00:49:25 helly Exp $ */
+/* $Id: simplexml.c,v 1.48 2003/07/04 21:58:09 sterling Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -177,7 +177,7 @@
        if (counter == 1) {
                SEPARATE_ZVAL(&value);
                zval_dtor(return_value);
-               FREE_ZVAL(return_value);
+               FREE_ZVAL(return_value); 
                return_value = value;
        }
 
@@ -715,7 +715,7 @@
 
 /* {{{ cast_object()
  */
-static inline void
+static void
 cast_object(zval *object, int type, char *contents TSRMLS_DC)
 {
        if (contents) {
@@ -727,7 +727,8 @@
 
        switch (type) {
                case IS_STRING:
-                       return;
+                       convert_to_string(object);
+                       break;
                case IS_BOOL:
                        convert_to_boolean(object);
                        break;
@@ -762,9 +763,8 @@
        }
 
        if (sxe->node) {
-               contents = xmlNodeListGetString((xmlDocPtr) sxe->document->ptr, 
sxe->node->children, 1);
-               if (!xmlIsBlankNode(sxe->node->children) && contents) {
-                       cast_object(writeobj, type, NULL TSRMLS_CC);
+               if (sxe->node->children) {
+                       contents = xmlNodeListGetString((xmlDocPtr) 
sxe->document->ptr, sxe->node->children, 1);
                }
        } 
 
@@ -1059,7 +1059,7 @@
 {
        php_info_print_table_start();
        php_info_print_table_header(2, "Simplexml support", "enabled");
-       php_info_print_table_row(2, "Revision", "$Revision: 1.47 $");
+       php_info_print_table_row(2, "Revision", "$Revision: 1.48 $");
        php_info_print_table_end();
 
 }



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

Reply via email to