mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fixed bug #65136 (RecursiveDirectoryIterator segfault)
This commit is contained in:
parent
76866e0a2e
commit
fa8611c81e
2 changed files with 9 additions and 6 deletions
1
NEWS
1
NEWS
|
@ -42,6 +42,7 @@ PHP NEWS
|
||||||
(Damjan Cvetko)
|
(Damjan Cvetko)
|
||||||
|
|
||||||
- SPL:
|
- SPL:
|
||||||
|
. Fixed bug #65136 (RecursiveDirectoryIterator segfault). (Laruence)
|
||||||
. Fixed bug #61828 (Memleak when calling Directory(Recursive)Iterator
|
. Fixed bug #61828 (Memleak when calling Directory(Recursive)Iterator
|
||||||
/Spl(Temp)FileObject ctor twice). (Laruence)
|
/Spl(Temp)FileObject ctor twice). (Laruence)
|
||||||
|
|
||||||
|
|
|
@ -1510,7 +1510,7 @@ SPL_METHOD(RecursiveDirectoryIterator, hasChildren)
|
||||||
Returns an iterator for the current entry if it is a directory */
|
Returns an iterator for the current entry if it is a directory */
|
||||||
SPL_METHOD(RecursiveDirectoryIterator, getChildren)
|
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 *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||||
spl_filesystem_object *subdir;
|
spl_filesystem_object *subdir;
|
||||||
char slash = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_UNIXPATHS) ? '/' : DEFAULT_SLASH;
|
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)) {
|
if (SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_CURRENT_AS_PATHNAME)) {
|
||||||
RETURN_STRINGL(intern->file_name, intern->file_name_len, 1);
|
RETURN_STRINGL(intern->file_name, intern->file_name_len, 1);
|
||||||
} else {
|
} else {
|
||||||
INIT_PZVAL(&zflags);
|
MAKE_STD_ZVAL(zflags);
|
||||||
INIT_PZVAL(&zpath);
|
MAKE_STD_ZVAL(zpath);
|
||||||
ZVAL_LONG(&zflags, intern->flags);
|
ZVAL_LONG(zflags, intern->flags);
|
||||||
ZVAL_STRINGL(&zpath, intern->file_name, intern->file_name_len, 0);
|
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);
|
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);
|
subdir = (spl_filesystem_object*)zend_object_store_get_object(return_value TSRMLS_CC);
|
||||||
if (subdir) {
|
if (subdir) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue