-
-
Notifications
You must be signed in to change notification settings - Fork 413
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
function call is_uploaded_file is not valid #133
Comments
@Alex-Bond i guess this issue is for you. |
@see0 hey! Can you create PR with some use cases? At this moment I don't really understand where the problem is. |
Hmm, i'm surprised that I am the only one facing this issue. The problem is caused by all (JSON) Data are relayed thru goridge, and then restored to PSR-7 Message in the worker. Hence, PHP is unable to add all the uploaded_files into their rfc1867_uploaded_files hash table - any function call to is_uploaded_file will return a FALSE result. When you try to perform any File Validation in Laravel/Symphony Request - the result will always be invalid. Well, I supposed is_uploaded_file is a php core function used in "olden/PHP 4" days to validate the file is uploaded. It's really an edge case, since solving it will only makes it easier to adopt other frameworks. My take is:
I'm planning to clean up my Laravel integration (with all the jingles - #103) and open source them in the coming weekend. |
I will describe in the documentation for now. |
I think the reason on not meeting this issue earlier is that most of the people rely on PSR-7 UploadedFileInterface which manage uploaded state separately. This issue seems to be Laravel/Symfony specific while mapping data to Request. Doesn't Symfony HttpKernel support file uploads set manually? |
@see0 any luck on your code release?) |
We (@jetexe) made fix for this case, (changes, working release). |
I fix this in PHP by copy and then unlink the temp file. in my case, the temp file is in the C: drive meanwhile my project want to move it in D: drive. I remembered that |
I am getting this issue when uploading files to my Laravel 9 and PHP 8.1 based backend running Roadrunner (latest version):
Does anyone have a workaround? |
RR manages uploads itself, and I guess Laraver interrupts this process and deletes the temporary file. |
@egonbraun Do you use |
I am using the latter. The spiral/roadrunner-laravel integration. |
Looks like it. Are you aware of any way to change this behaviour? I know you are not a PHP or Laravel specialist but I could definitely use some ideas. |
We may introduce a special flag, but, you may have a look at this ticket: roadrunner-php/laravel-bridge#84, I guess it was precisely your problem. |
At least he was able to get the files, I am not even reaching the controller at this point. Seems like the issue is happening while the request object is being created. The class that fails is part of this library:
So it looks more like what @see0 was describing here:
|
To say in truth, we don't actively support this integration. You may try to use a |
To be clear, we're using Spiral + Roadrunner, and not Octane + Roadrunner. Is there a suggested way of handling file uploads with Laravel9+Php8.1? Thanks! |
Maybe @butschster can help. |
It looks like https://github.com/avto-dev/roadrunner-laravel/pull/12/files might fix it? Perhaps the ability to set --not-fix-symfony-file-validation would fix the issue? Or maybe we're processing file uploads in some deprecated way the relies on is_uploaded_file? Originally, our app was written on Laravel 5 and it has slowly evolved into a behemoth on Laravel 9. |
Not sure if this is helpful or not, but this is the error we see:
We're using Intervention/image; but we think this error will occur with any uploaded file. |
Also, files don't appear in /tmp; they never seem to be written. This is the permission on /tmp: |
Sorry about flooding this issue with comments; we were just VERY excited to move from FPM to Roadrunner. It showed a 22% reduction in overall latency and a 45% reduction of CPU compared to FPM. |
NP at all, this is not a flood. But it would be better to move the discussion to a separate ticket. Could you please create a new ticket and copy-paste the discussion above? |
Will do! |
Symphony and Laravel UploadedFile class consider all uploded as invalid due to the is_uploaded_file check.
vendor/symfony/http-foundation/File/UploadedFile.php
Swoole solution: swoole/swoole-src#407
My current workaround - I subclassed both HttpFoundationFactory, UploadedFile to get around this issue.
Let me know if this issue is going to be solved here (upstream) or should I send a pull request for my workaround to https://github.com/UPDG/roadrunner-laravel.
Thanks
The text was updated successfully, but these errors were encountered: