From: Xinchen Hui Date: Fri, 28 Feb 2014 08:06:47 +0000 (+0800) Subject: Fixed un-initilized iterator in DirectoyItrator X-Git-Tag: POST_PHPNG_MERGE~412^2~490 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b353d5abe95675fab70f66ee79d8f503bc7f1e69;p=php Fixed un-initilized iterator in DirectoyItrator --- diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index e82e13248e..bbe66fbc6c 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -4175,7 +4175,7 @@ ZEND_METHOD(reflection_class, isInstance) Returns an instance of this class */ ZEND_METHOD(reflection_class, newInstance) { - zval *retval_ptr = NULL; + zval retval; reflection_object *intern; zend_class_entry *ce, *old_scope; zend_function *constructor; @@ -4216,7 +4216,7 @@ ZEND_METHOD(reflection_class, newInstance) ZVAL_UNDEF(&fci.function_name); fci.symbol_table = NULL; fci.object_ptr = return_value; - fci.retval = retval_ptr; + fci.retval = &retval; fci.param_count = num_args; fci.params = params; fci.no_separation = 1; @@ -4231,15 +4231,15 @@ ZEND_METHOD(reflection_class, newInstance) if (params) { efree(params); } - if (retval_ptr) { - zval_ptr_dtor(retval_ptr); + if (!ZVAL_IS_UNDEF(&retval)) { + zval_ptr_dtor(&retval); } php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invocation of %s's constructor failed", ce->name->val); zval_dtor(return_value); RETURN_NULL(); } - if (retval_ptr) { - zval_ptr_dtor(retval_ptr); + if (!ZVAL_IS_UNDEF(&retval)) { + zval_ptr_dtor(&retval); } if (params) { efree(params); diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index fcfeb33f07..604aca7e81 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -158,6 +158,7 @@ static zend_object *spl_filesystem_object_new_ex(zend_class_entry *class_type TS zend_object_std_init(&intern->std, class_type TSRMLS_CC); object_properties_init(&intern->std, class_type); + zend_iterator_init(&intern->it.intern TSRMLS_CC); intern->std.handlers = &spl_filesystem_object_handlers; return &intern->std;