diff --git a/ext/standard/tests/file/ftruncate_bug76422.phpt b/ext/standard/tests/file/ftruncate_bug76422.phpt index 77334545a97cf..d291ec2efc679 100644 --- a/ext/standard/tests/file/ftruncate_bug76422.phpt +++ b/ext/standard/tests/file/ftruncate_bug76422.phpt @@ -23,6 +23,8 @@ $truncate_offset = 2 * 1024 * 1024 * 1024; $ftruncate_result = ftruncate($file_handle, $truncate_offset); if (false === $ftruncate_result) { var_dump(true); + fclose($file_handle); + unlink($fn); return; } @@ -30,11 +32,17 @@ $truncate_offset = 4 * 1024 * 1024 * 1024 + 1; $ftruncate_result = ftruncate($file_handle, $truncate_offset); if (false === $ftruncate_result) { + // NOTE: unlink() is deliberately repeated - If this test runs out of disk space attempting to reserve space for this temporary file, + // then the --CLEAN-- script can't be run (if we don't delete the file), + // because there wouldn't be any free disk space to save a new php file. + fclose($file_handle); + unlink($fn); die('Truncate has failed :/'); } fclose($file_handle); var_dump(filesize($fn) >= $truncate_offset); +unlink($fn); ?> --CLEAN--