Skip to content

PHP 8.3.17 - Very strange is_file() issue on CLI #17915

@everdio

Description

@everdio

Description

To reproduce this you can create these 3 files:
test1.php

<?php foreach (\array_fill(0, 10, "test") as $key => $content) { \file_put_contents("test_" . $key . ".tmp", $content); }

test2.php
<?php while(true) { foreach (\array_fill(0, 10, "test") as $key => $content) { $file = "test_" . $key . ".tmp"; echo \is_file($file) . " => " . \file_exists($file) . \PHP_EOL; } sleep(2); }

and test3.php
<?php foreach (\array_fill(0, 10, "test") as $key => $content) { \unlink("test_" . $key . ".tmp"); sleep(2); }

First yuu run test1.php, this just creates 10 dummy files. Then start running test2.php and open another terminal. In that second terminal run test3.php which will remove the files 1 by 1.

test2.php will start outputting as expected, until the very last file, it will keep reporting the final is_file as true while the file is really gone ?

PHP Version

PHP 8.3.17

Operating System

Debian GNU/Linux 12 (bookworm)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions