Fixed bug #67359 (Segfault in recursiveDirectoryIterator)

This commit is contained in:
Xinchen Hui 2014-06-01 19:41:01 +08:00
parent b5d9983ff4
commit 38be99b739
4 changed files with 33 additions and 0 deletions

1
NEWS
View File

@ -7,6 +7,7 @@ PHP NEWS
(Adam)
- SPL:
. Fixed bug #67359 (Segfault in recursiveDirectoryIterator). (Laruence)
. Fixed bug #67360 (Missing element after ArrayObject::getIterator). (Adam)
?? ??? 2014, PHP 5.4.29

View File

@ -829,6 +829,7 @@ SPL_METHOD(DirectoryIterator, seek)
zend_call_method_with_0_params(&this_ptr, Z_OBJCE_P(getThis()), &intern->u.dir.func_rewind, "rewind", &retval);
if (retval) {
zval_ptr_dtor(&retval);
retval = NULL;
}
}
@ -838,6 +839,7 @@ SPL_METHOD(DirectoryIterator, seek)
if (retval) {
valid = zend_is_true(retval);
zval_ptr_dtor(&retval);
retval = NULL;
}
if (!valid) {
break;

View File

@ -861,6 +861,8 @@ static union _zend_function *spl_recursive_it_get_method(zval **object_ptr, char
*object_ptr = zobj;
function_handler = Z_OBJ_HT_P(*object_ptr)->get_method(object_ptr, method, method_len, key TSRMLS_CC);
}
} else {
*object_ptr = zobj;
}
}
return function_handler;

View File

@ -0,0 +1,28 @@
--TEST--
Bug #67359 (Segfault in recursiveDirectoryIterator)
--FILE--
<?php
try
{
$rdi = new recursiveDirectoryIterator(dirname(__FILE__), FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS);
$it = new recursiveIteratorIterator( $rdi );
$it->seek(1);
while( $it->valid())
{
if( $it->isFile() )
{
$it->current();
}
$it->next();
}
$it->current();
}
catch(Exception $e)
{
}
echo "okey"
?>
--EXPECTF--
okey