2929
3030#include "php_spl.h"
3131#include "spl_functions.h"
32- #include "spl_engine.h"
3332#include "spl_iterators.h"
3433#include "spl_directory.h"
3534#include "spl_directory_arginfo.h"
@@ -1516,7 +1515,6 @@ PHP_METHOD(RecursiveDirectoryIterator, hasChildren)
15161515/* {{{ Returns an iterator for the current entry if it is a directory */
15171516PHP_METHOD (RecursiveDirectoryIterator , getChildren )
15181517{
1519- zval zpath , zflags ;
15201518 spl_filesystem_object * intern = spl_filesystem_from_obj (Z_OBJ_P (ZEND_THIS ));
15211519 spl_filesystem_object * subdir ;
15221520 char slash = SPL_HAS_FLAG (intern -> flags , SPL_FILE_DIR_UNIXPATHS ) ? '/' : DEFAULT_SLASH ;
@@ -1529,10 +1527,15 @@ PHP_METHOD(RecursiveDirectoryIterator, getChildren)
15291527 RETURN_THROWS ();
15301528 }
15311529
1532- ZVAL_LONG (& zflags , intern -> flags );
1533- ZVAL_STR_COPY (& zpath , intern -> file_name );
1534- spl_instantiate_arg_ex2 (Z_OBJCE_P (ZEND_THIS ), return_value , & zpath , & zflags );
1535- zval_ptr_dtor (& zpath );
1530+ zval params [2 ];
1531+ ZVAL_STR_COPY (& params [0 ], intern -> file_name );
1532+ ZVAL_LONG (& params [1 ], intern -> flags );
1533+
1534+ zend_result is_initialized = object_init_with_constructor (return_value , Z_OBJCE_P (ZEND_THIS ), 2 , params , NULL );
1535+ zval_ptr_dtor_str (& params [0 ]);
1536+ if (is_initialized == FAILURE ) {
1537+ RETURN_THROWS ();
1538+ }
15361539
15371540 subdir = spl_filesystem_from_obj (Z_OBJ_P (return_value ));
15381541 if (subdir ) {
0 commit comments