Merge branch 'PHP-5.5'

This commit is contained in:
Xinchen Hui 2013-06-25 13:40:19 +08:00
commit d8374c5590
2 changed files with 17 additions and 0 deletions

View File

@ -710,6 +710,12 @@ void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, long ctor_fla
}
intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
if (intern->_path) {
/* object is alreay initialized */
zend_restore_error_handling(&error_handling TSRMLS_CC);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Directory object is already initialized");
return;
}
intern->flags = flags;
#ifdef HAVE_GLOB
if (SPL_HAS_FLAG(ctor_flags, DIT_CTOR_GLOB) && strstr(path, "glob://") != path) {

View File

@ -0,0 +1,11 @@
--TEST--
Bug #61828 (Memleak when calling Directory(Recursive)Iterator/Spl(Temp)FileObject ctor twice)
--FILE--
<?php
$x = new DirectoryIterator('.');
$x->__construct('/tmp');
echo "Okey";
?>
--EXPECTF--
Warning: DirectoryIterator::__construct(): Directory object is already initialized in %sbug61828.php on line 3
Okey