Skip to content

Files driver rare bug #694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
arnaspet opened this issue Jun 18, 2019 · 2 comments
Closed

Files driver rare bug #694

arnaspet opened this issue Jun 18, 2019 · 2 comments

Comments

@arnaspet
Copy link

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

@stale
Copy link

stale bot commented Jul 3, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@Geolim4
Copy link
Member

Geolim4 commented Jul 4, 2019

Hello,

I'll push a fix ASAP since this could be caused by the fact that php is "caching" file stats and returning "false" while the file currently exists.

Cheers,
Georges

@Geolim4 Geolim4 closed this as completed in 7f38a63 Jul 4, 2019
Geolim4 added a commit that referenced this issue Jul 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants