Skip to content

Commit

Permalink
Fix file test race condition
Browse files Browse the repository at this point in the history
005_variation2.phpt creates files with special names, and
filesize_variation5.phpt checks for filesize of inexistent files with special
names. Create the files in a separate directory to avoid these tests clashing.

Closes GH-12692
  • Loading branch information
iluuu1994 authored and ramsey committed Nov 23, 2023
1 parent 4f5ba05 commit e1e140f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ext/standard/tests/file/005_variation2.phpt
Expand Up @@ -28,6 +28,11 @@ function stat_fn( $filename ) {

echo "*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***\n";
echo "\n*** testing touch ***\n";

$dir = __DIR__ . '/005_variation2';
mkdir($dir);
chdir($dir);

$b = touch(false);
$c = touch('');
$d = touch(' ');
Expand All @@ -47,6 +52,7 @@ stat_fn('|');

var_dump(unlink(' '));
var_dump(unlink('|'));
rmdir($dir);

echo "Done";
?>
Expand Down

0 comments on commit e1e140f

Please sign in to comment.