-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Closed
Labels
Description
- Laravel Version: 6.5.2
- PHP Version: 7.3
- Database Driver & Version:
n/a
Description:
In our tests we create a fake file:
use Illuminate\Http\UploadedFile;
$uploadedFile = UploadedFile::fake()->create('foo.docx', '20');
This causes an error:
ErrorException : file_put_contents() expects parameter 1 to be a valid path, resource given
/var/www/api/vendor/laravel/framework/src/Illuminate/Http/Testing/FileFactory.php:21
/var/www/api/tests/Api/v2/File/Controllers/FileControllerTest.php:42
I believe the bug was introduced in 181db51
The return value of tmpfile()
is being passed to file_put_contents()
. However, tmpfile()
returns a resource, whereas file_put_contents()
expects a string containing a path.
Steps To Reproduce:
use Illuminate\Http\UploadedFile;
$uploadedFile = UploadedFile::fake()->create('foo.docx', '20');