Skip to content

Files driver rare bug #694

@arnaspet

Description

@arnaspet

Configuration

  • PhpFastCache version: 7.0.5
  • PhpFastCache API version: 2.0.4
  • PHP version: PHP 7.2.19-1+0~20190531112637.22+stretch~1.gbp75765b (cli) (built: May 31 2019 11:26:38) ( NTS )
  • Operating system: Debian 9

Describe the bug

Return value of Phpfastcache\Drivers\Files\Driver::readfile() must be of the type string, boolean returned

vendor/phpfastcache/phpfastcache/lib/Phpfastcache/Core/Pool/IO/IOHelperTrait.php in readfile at line 259

    {
        if (\function_exists('file_get_contents')) {
            return \file_get_contents($file);
        }

To Reproduce
Happens really rarely ( 0.01...% percent )

Expected behavior

well it should throw at least an exception with why it couldnt read file content.

Also config for Files driver

     CacheManager::setDefaultConfig(new FilesConfig([
                'path' => <doesnt-matter>,
                'securityKey' => <doesnt_matter>,
                'secureFileManipulation' => true,
                'preventCacheSlams' => true,
            ]));

Oh and i tried printing out what was the error with error_get_last. it returns that failed to open stream: No such file or directory

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