mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
Fixed bug #67359 (Segfault in recursiveDirectoryIterator)
This commit is contained in:
parent
b5d9983ff4
commit
38be99b739
1
NEWS
1
NEWS
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
28
ext/spl/tests/bug67359.phpt
Normal file
28
ext/spl/tests/bug67359.phpt
Normal 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
|
Loading…
Reference in New Issue
Block a user