Skip to content

Commit 5c1fbd6

Browse files
committed
Merge branch '5.2' into 5.3
* 5.2: [Validator] Backport type fixes [HttpFoundation] fix FileBag under PHP 8.1 Fix composer resolution on windows
2 parents 2369fa2 + 4761025 commit 5c1fbd6

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

FileBag.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ protected function convertFileInformation($file)
111111
*/
112112
protected function fixPhpFilesArray(array $data)
113113
{
114+
// Remove extra key added by PHP 8.1.
115+
unset($data['full_path']);
114116
$keys = array_keys($data);
115117
sort($keys);
116118

Tests/FileBagTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,23 @@ public function testShouldConvertsUploadedFiles()
4545
$this->assertEquals($file, $bag->get('file'));
4646
}
4747

48+
public function testShouldConvertsUploadedFilesPhp81()
49+
{
50+
$tmpFile = $this->createTempFile();
51+
$file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain');
52+
53+
$bag = new FileBag(['file' => [
54+
'name' => basename($tmpFile),
55+
'full_path' => basename($tmpFile),
56+
'type' => 'text/plain',
57+
'tmp_name' => $tmpFile,
58+
'error' => 0,
59+
'size' => null,
60+
]]);
61+
62+
$this->assertEquals($file, $bag->get('file'));
63+
}
64+
4865
public function testShouldSetEmptyUploadedFilesToNull()
4966
{
5067
$bag = new FileBag(['file' => [

0 commit comments

Comments
 (0)