--- embedaddon/php/ext/spl/spl_directory.c 2013/07/22 01:32:01 1.1.1.3 +++ embedaddon/php/ext/spl/spl_directory.c 2013/10/14 08:02:32 1.1.1.4 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_directory.c,v 1.1.1.3 2013/07/22 01:32:01 misho Exp $ */ +/* $Id: spl_directory.c,v 1.1.1.4 2013/10/14 08:02:32 misho Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -710,6 +710,12 @@ void spl_filesystem_object_construct(INTERNAL_FUNCTION } intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + if (intern->_path) { + /* object is alreay initialized */ + zend_restore_error_handling(&error_handling TSRMLS_CC); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Directory object is already initialized"); + return; + } intern->flags = flags; #ifdef HAVE_GLOB if (SPL_HAS_FLAG(ctor_flags, DIT_CTOR_GLOB) && strstr(path, "glob://") != path) { @@ -1504,7 +1510,7 @@ SPL_METHOD(RecursiveDirectoryIterator, hasChildren) Returns an iterator for the current entry if it is a directory */ SPL_METHOD(RecursiveDirectoryIterator, getChildren) { - zval zpath, zflags; + zval *zpath, *zflags; spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); spl_filesystem_object *subdir; char slash = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_UNIXPATHS) ? '/' : DEFAULT_SLASH; @@ -1518,11 +1524,13 @@ SPL_METHOD(RecursiveDirectoryIterator, getChildren) if (SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_CURRENT_AS_PATHNAME)) { RETURN_STRINGL(intern->file_name, intern->file_name_len, 1); } else { - INIT_PZVAL(&zflags); - INIT_PZVAL(&zpath); - ZVAL_LONG(&zflags, intern->flags); - ZVAL_STRINGL(&zpath, intern->file_name, intern->file_name_len, 0); - spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), &return_value, 0, &zpath, &zflags TSRMLS_CC); + MAKE_STD_ZVAL(zflags); + MAKE_STD_ZVAL(zpath); + ZVAL_LONG(zflags, intern->flags); + ZVAL_STRINGL(zpath, intern->file_name, intern->file_name_len, 1); + spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), &return_value, 0, zpath, zflags TSRMLS_CC); + zval_ptr_dtor(&zpath); + zval_ptr_dtor(&zflags); subdir = (spl_filesystem_object*)zend_object_store_get_object(return_value TSRMLS_CC); if (subdir) {