Commit:    fa8611c81ee72839cdff3e72b18cc586feb4aa29
Author:    Xinchen Hui <larue...@php.net>         Thu, 27 Jun 2013 12:37:57 
+0800
Parents:   76866e0a2e5e8175621edfce9b4c091d3007d42a
Branches:  PHP-5.4 PHP-5.5 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=fa8611c81ee72839cdff3e72b18cc586feb4aa29

Log:
Fixed bug #65136 (RecursiveDirectoryIterator segfault)

Bugs:
https://bugs.php.net/65136

Changed paths:
  M  NEWS
  M  ext/spl/spl_directory.c


Diff:
diff --git a/NEWS b/NEWS
index c7e4c58..a4295e8 100644
--- a/NEWS
+++ b/NEWS
@@ -42,6 +42,7 @@ PHP                                                           
             NEWS
     (Damjan Cvetko)
 
 - SPL:
+  . Fixed bug #65136 (RecursiveDirectoryIterator segfault). (Laruence)
   . Fixed bug #61828 (Memleak when calling Directory(Recursive)Iterator
     /Spl(Temp)FileObject ctor twice). (Laruence)
 
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 056e7e4..7f0ce63 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -1510,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;
@@ -1524,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) {


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to