--- embedaddon/php/ext/simplexml/simplexml.c	2013/07/22 01:32:01	1.1.1.3
+++ embedaddon/php/ext/simplexml/simplexml.c	2014/06/15 20:03:55	1.1.1.5
@@ -2,7 +2,7 @@
   +----------------------------------------------------------------------+
   | PHP Version 5                                                        |
   +----------------------------------------------------------------------+
-  | Copyright (c) 1997-2013 The PHP Group                                |
+  | Copyright (c) 1997-2014 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.01 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: simplexml.c,v 1.1.1.3 2013/07/22 01:32:01 misho Exp $ */
+/* $Id: simplexml.c,v 1.1.1.5 2014/06/15 20:03:55 misho Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1070,7 +1070,7 @@ static HashTable * sxe_get_prop_hash(zval *object, int
 	int              namelen;
 	int              test;
 	char 		 use_iter;
-	zval            *iter_data;
+	zval            *iter_data = NULL;
 
 	use_iter = 0;
 
@@ -1129,7 +1129,7 @@ static HashTable * sxe_get_prop_hash(zval *object, int
 			node = NULL;
 		} else if (sxe->iter.type != SXE_ITER_CHILD) {
 
-			if ( !node->children || !node->parent || node->children->next || node->children->children || node->parent->children == node->parent->last ) {
+			if ( !node->children || !node->parent || !node->next || node->children->next || node->children->children || node->parent->children == node->parent->last ) {
 				node = node->children;
 			} else {
 				iter_data = sxe->iter.data;
@@ -1269,6 +1269,9 @@ SXE_METHOD(xpath)
 	}
 	if (!sxe->node) {
 		php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, xmlDocGetRootElement((xmlDocPtr) sxe->document->ptr), NULL TSRMLS_CC);
+		if (!sxe->node) {
+			RETURN_FALSE;
+		}
 	}
 
 	nodeptr = php_sxe_get_first_node(sxe, sxe->node->node TSRMLS_CC);
@@ -1533,15 +1536,18 @@ SXE_METHOD(getDocNamespaces)
 		return;
 	}
 
-	array_init(return_value);
-
 	sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
 	if(from_root){
 		node = xmlDocGetRootElement((xmlDocPtr)sxe->document->ptr);
 	}else{
 		GET_NODE(sxe, node);
 	}
-
+	
+	if (node == NULL) {
+		RETURN_FALSE;
+	}
+	
+	array_init(return_value);
 	sxe_add_registered_namespaces(sxe, node, recursive, return_value TSRMLS_CC);
 }
 /* }}} */
@@ -2659,7 +2665,7 @@ PHP_MINFO_FUNCTION(simplexml)
 {
 	php_info_print_table_start();
 	php_info_print_table_header(2, "Simplexml support", "enabled");
-	php_info_print_table_row(2, "Revision", "$Id: simplexml.c,v 1.1.1.3 2013/07/22 01:32:01 misho Exp $");
+	php_info_print_table_row(2, "Revision", "$Id: simplexml.c,v 1.1.1.5 2014/06/15 20:03:55 misho Exp $");
 	php_info_print_table_row(2, "Schema support",
 #ifdef LIBXML_SCHEMAS_ENABLED
 		"enabled");