biigle / laravel-file-cache

Fetch and cache files from local filesystem, cloud storage or public webservers in Laravel or Lumen
MIT License
11 stars 5 forks source link

Undefined array key "timed_out" #11

Closed neylsongularte closed 3 years ago

neylsongularte commented 3 years ago

https://github.com/biigle/laravel-file-cache/blob/d2fedde41ce85d309be5456aa28494774400ed90/src/FileCache.php#L544

Value of stream_get_meta_data($source):

^ array:6 [▼ "wrapper_type" => "PHP" "stream_type" => "TEMP" "mode" => "w+b" "unread_bytes" => 0 "seekable" => true "uri" => "php://temp" ]

neylsongularte commented 3 years ago

^ ErrorException {#484 ▼

message: "Undefined array key "timed_out""

code: 0

file: "vendor/biigle/laravel-file-cache/src/FileCache.php"

line: 545

severity: E_WARNING

trace: {▶} }

neylsongularte commented 3 years ago

Catched in FileCache line 390

mzur commented 3 years ago

Looks like you are using a php://temp resource somehow, correct? Which PHP version do you use? stream_get_meta_data sems to behave strangely here, as timed_out should always be present according to the docs. This can be caught by checking array key existence but I'd like to know why and how you are using the temp resource here, first (before we fix the symptom instead of the cause).

neylsongularte commented 3 years ago

I am using php 8.0.9 on macos

neylsongularte commented 3 years ago

The search is realized on minio server s3 compatible

mzur commented 3 years ago

I still don't know exactly why this happens and the array key is not present (maybe a bug in PHP?). But I released a new version with a check that should fix this error for you, as the check shouldn't hurt...

neylsongularte commented 3 years ago

Thanks