clearstatcache

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Clears file status cache
<?php clearstatcache(bool $clear_realpath_cache = false, string $filename = ""): void
<?php         if ($handle) {

            try {

                if (flock($handle, LOCK_SH)) {

                    clearstatcache(true, $path);



                    $contents = fread($handle, $this->size($path) ?: 1);
<?php     public function replace($path, $content, $mode = null)

    {


        clearstatcache(true, $path);



        $path = realpath($path) ?: $path;
<?php         foreach ($paths as $path) {

            try {

                if (@unlink($path)) {

                    clearstatcache(false, $path);

                } else {

                    $success = false;

                }
<?php     public function assertExists($path, $content = null)

    {

        clearstatcache();



        $paths = Arr::wrap($path);
<?php     public function assertMissing($path)

    {

        clearstatcache();



        $paths = Arr::wrap($path);
<?php     public function read($length = null)

    {

        clearstatcache(true, $this->path);



        return fread($this->handle, $length ?? ($this->size() ?: 1));

    }
<?php         while ($process->isRunning()) {

            if ($hasEnvironment) {

                clearstatcache(false, $environmentFile);

            }



            if (! $this->option('no-reload') &&
<?php         Process::fromShellCommandline("rm {$this->stubFile}")->run();



        clearstatcache(true, $this->stubFile);

        $this->assertFalse(File::exists($this->stubFile));

    }
<?php         Process::fromShellCommandline("rm {$this->stubFile}")->run();



        clearstatcache(true, $this->stubFile);

        $this->assertFalse(File::isFile($this->stubFile));

    }
<?php         Process::fromShellCommandline("rm {$this->stubFile}")->run();



        clearstatcache(true, $this->stubFile);

        Storage::disk('public')->assertMissing('StardewTaylor.png');

        $this->assertFalse(Storage::disk('public')->exists('StardewTaylor.png'));

    }
<?php             $mkdirError = error_get_last();

        }



        clearstatcache(false, $dirname);



        if ( ! is_dir($dirname)) {

            $errorMessage = isset($mkdirError['message']) ? $mkdirError['message'] : '';
<?php     public function visibility(string $path): FileAttributes

    {

        $location = $this->prefixer->prefixPath($path);

        clearstatcache(false, $location);

        error_clear_last();

        $fileperms = @fileperms($location);
<?php     private function assertFileHasPermissions(string $file, int $expectedPermissions): void

    {

        clearstatcache(false, $file);

        $permissions = fileperms($file) & 0777;

        $this->assertEquals($expectedPermissions, $permissions);

    }
<?php         $result = $this->getProcess()->execute($cmd, $output) === 0;




        clearstatcache();



        if ($result && !is_dir($directory)) {

            return true;
<?php         return $promise->then(function ($process) use ($directory) {


            clearstatcache();



            if ($process->isSuccessful()) {

                if (!is_dir($directory)) {