error_clear_last

Supported Versions: PHP 7, PHP 8
Clear the most recent error
<?php error_clear_last(): void
<?php                 continue;

            }



            error_clear_last();

            $result = @ftp_mkdir($connection, $location);



            if ($result === false) {
<?php             dirname($prefixedLocation),

            $this->resolveDirectoryVisibility($config->get(Config::OPTION_DIRECTORY_VISIBILITY))

        );

        error_clear_last();



        if (($size = @file_put_contents($prefixedLocation, $contents, $this->writeFlags)) === false) {

            throw UnableToWriteFile::atLocation($path, error_get_last()['message'] ?? '');
<?php             $this->resolveDirectoryVisibility($config->get(Config::OPTION_DIRECTORY_VISIBILITY))

        );



        error_clear_last();

        $stream = @fopen($prefixedLocation, 'w+b');



        if ( ! ($stream && false !== stream_copy_to_stream($contents, $stream) && fclose($stream))) {
<?php             return;

        }



        error_clear_last();



        if ( ! @unlink($location)) {

            throw UnableToDeleteFile::atLocation($location, error_get_last()['message'] ?? '');
<?php     public function read(string $path): string

    {

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

        error_clear_last();

        $contents = @file_get_contents($location);



        if ($contents === false) {
<?php     public function readStream(string $path)

    {

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

        error_clear_last();

        $contents = @fopen($location, 'rb');



        if ($contents === false) {
<?php             return;

        }



        error_clear_last();



        if ( ! @mkdir($dirname, $visibility, true)) {

            $mkdirError = error_get_last();
<?php             return;

        }



        error_clear_last();



        if ( ! @mkdir($location, $permissions, true)) {

            throw UnableToCreateDirectory::atLocation($path, error_get_last()['message'] ?? '');
<?php     {

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

        clearstatcache(false, $location);

        error_clear_last();

        $fileperms = @fileperms($location);



        if ($fileperms === false) {
<?php     public function mimeType(string $path): FileAttributes

    {

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

        error_clear_last();

        $mimeType = $this->mimeTypeDetector->detectMimeTypeFromFile($location);



        if ($mimeType === null) {
<?php     public function lastModified(string $path): FileAttributes

    {

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

        error_clear_last();

        $lastModified = @filemtime($location);



        if ($lastModified === false) {
<?php     public function fileSize(string $path): FileAttributes

    {

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

        error_clear_last();



        if (is_file($location) && ($fileSize = @filesize($location)) !== false) {

            return new FileAttributes($path, $fileSize);
<?php     private function setPermissions(string $location, int $visibility): void

    {

        error_clear_last();

        if ( ! @chmod($location, $visibility)) {

            $extraMessage = error_get_last()['message'] ?? '';

            throw UnableToSetVisibility::atLocation($this->prefixer->stripPrefix($location), $extraMessage);