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
Argument 1 passed to phpFastCache\Core\DriverAbstract::driverUnwrapTime() must be of the type array, boolean given #330
Comments
I'll check it out. What's your Os/driver used? Le 25 juil. 2016 15:00, "phuyem" notifications@github.com a écrit :
|
It is Windows 10, Files driver . I proposed a fix actually, in \phpfastcache\phpfastcache\src\phpFastCache\Drivers\Files\Driver.php, line 122, adding " !is_array($object) || "
|
I will make some test, the weird part is that i'm testing on a strict environment, so this error should appeared before oO |
Is that boolean true or false ? |
I just applied phpfastcache for around 1 week, no problem on Windows 10 so far. The problem happened on our Production, which is ubuntu 16.04, the cache location is /tmp. we are running nginx-fpm along with php command client for cron job. Merci pour la reponse rapide et le superbe lib :-) |
Merci de lui faire confiance et de lui donner sa chance :) I'm gonna made an additional check on the abstract class. May this will help. |
False, I guess it may be some data corruption or something #0 /somepath/ow_libraries/vendor/phpfastcache/phpfastcache/src/phpFastCache/Drivers/Files/Driver.php(122): phpFastCache\Core\DriverAbstract->driverUnwrapTime(false) the error looks minor but it does crash the whole flow... so I dunno if I should catch that error... |
It must be true because this statement is true: |
hmm, I see.. but wait you are showing line 57, but this error occurred at line 55 #1 /somepath/ow_libraries/vendor/phpfastcache/phpfastcache/src/phpFastCache/Core/StandardPsr6StructureTrait.php(55): phpFastCache\Drivers\Files\Driver->driverRead(Object(phpFastCache\Drivers\Files\Item)) and the log said it is a "false" |
Weird, what do you have at line 122 ? Can you dump the whole file on gist please ? |
Can you replace if ($driverArray) { with if ($driverArray && is_array($driverArray)) { |
@phuyem Is it working for you ? |
@phuyem Bump ! |
@phuyem I need your confirmation before merging this patch, thanks ! |
Sorry Geolim4 for the late reply. I was on vacation. Here is what I did in line 122 Driver.php
=>
I guess your solution is better. But I just don't want to test since it is production and it is working with my fix. So I guess it is an OK from me. Again thank you for your great library. Merci les gars! |
@phuyem: I have another code at line 122 in Files/Driver.php |
The main reason that the decode methods returns a boolean is that the serialized string is truncated or corrupted which leads unserialize to returns false. |
@phuyem are you sure that you got the very latest version ? |
Hmm your're right and additional there should be an exception in the line before that (121) because driverUnwrapData() needs an array as well, but somehow it passes this call. Well I just updated my production environment to the latest version and if the error is thrown the next time I will take another look. Anyways, I strongly encourage to add the is_array check! |
Ok got it, i will fix it asap :) |
This just rarely happens but it is still a bug
My guess :
in \phpfastcache\phpfastcache\src\phpFastCache\Drivers\Files\Driver.php
$object = $this->decode($content);
not always return array.
Can I make a fix like this : adding !is_array($object) ||
The text was updated successfully, but these errors were encountered: