php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #64997
Patch bug64997.patch revision 2013-06-09 10:43 UTC by laruence@php.net
Patch bug64977.patch revision 2013-06-09 10:33 UTC by laruence@php.net

Patch bug64977.patch for Reproducible crash Bug #64997

Patch version 2013-06-09 10:33 UTC

Return to Bug #64997 | Download this patch
This patch is obsolete

Obsoleted by patches:

Patch Revisions:

Developer: laruence@php.net

diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index fcb4d20..8ebda65 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -1013,12 +1013,14 @@ static void spl_recursive_tree_iterator_get_entry(spl_recursive_it_object * obje
 	zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling TSRMLS_CC);
 	if (data && *data) {
 		RETVAL_ZVAL(*data, 1, 0);
-	}
-	if (Z_TYPE_P(return_value) == IS_ARRAY) {
-		zval_dtor(return_value);
-		ZVAL_STRINGL(return_value, "Array", sizeof("Array")-1, 1);
+		if (Z_TYPE_P(return_value) == IS_ARRAY) {
+			zval_dtor(return_value);
+			ZVAL_STRINGL(return_value, "Array", sizeof("Array")-1, 1);
+		} else {
+			convert_to_string(return_value);
+		}
 	} else {
-		convert_to_string(return_value);
+		RETVAL_EMPTY_STRING();
 	}
 	zend_restore_error_handling(&error_handling TSRMLS_CC);
 }
@@ -1119,6 +1121,9 @@ SPL_METHOD(RecursiveTreeIterator, current)
 		}
 	}

+	INIT_ZVAL(prefix);
+	INIT_ZVAL(entry);
+	INIT_ZVAL(postfix);
 	spl_recursive_tree_iterator_get_prefix(object, &prefix TSRMLS_CC);
 	spl_recursive_tree_iterator_get_entry(object, &entry TSRMLS_CC);
 	spl_recursive_tree_iterator_get_postfix(object, &postfix TSRMLS_CC);
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 23 18:01:55 2014 UTC