[php-src] Issue #9751: `full_path` in `$_FILES` is a root array, instead of a key in files' arrays
| From: | Simbiat | Date: | Fri, 14 Oct 2022 15:28:27 +0000 |
| Subject: | [php-src] Issue #9751: `full_path` in `$_FILES` is a root array, instead of a key in files' arrays | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242597@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9751
Author: Simbiat
### Description
As per [manual](https://www.php.net/manual/en/features.file-upload.post-method.php),
$_FILES has $_FILES['userfile']['full_path'], which
implies, that doing var_dump($_FILES); would give this result:
```
array(1) {
["files"]=>
array(2) {
["avatar"]=>
array(5) {
["name"]=>
string(15) "photosquare.jpg"
["type"]=>
string(10) "image/jpeg"
["size"]=>
int(153785)
["tmp_name"]=>
string(89)
"C:\Users\simbi\OneDrive\Documents\!Personal\Coding\WebServer\htdocs\data\temp\phpC014.tmp"
["error"]=>
int(0)
["full_path"]=>
string(15) "photosquare.jpg"
}
["text"]=>
array(5) {
["name"]=>
string(9) "Relex.txt"
["type"]=>
string(10) "text/plain"
["size"]=>
int(991)
["tmp_name"]=>
string(89)
"C:\Users\simbi\OneDrive\Documents\!Personal\Coding\WebServer\htdocs\data\temp\phpC044.tmp"
["error"]=>
int(0)
["full_path"]=>
string(15) "Relex.txt"
}
}
}
```
But instead on 8.1.9 I am getting this:
```
array(1) {
["files"]=>
array(3) {
["full_path"]=>
array(2) {
["avatar"]=>
string(15) "photosquare.jpg"
["text"]=>
string(9) "Relex.txt"
}
["avatar"]=>
array(5) {
["name"]=>
string(15) "photosquare.jpg"
["type"]=>
string(10) "image/jpeg"
["size"]=>
int(153785)
["tmp_name"]=>
string(89)
"C:\Users\simbi\OneDrive\Documents\!Personal\Coding\WebServer\htdocs\data\temp\phpC014.tmp"
["error"]=>
int(0)
}
["text"]=>
array(5) {
["name"]=>
string(9) "Relex.txt"
["type"]=>
string(10) "text/plain"
["size"]=>
int(991)
["tmp_name"]=>
string(89)
"C:\Users\simbi\OneDrive\Documents\!Personal\Coding\WebServer\htdocs\data\temp\phpC044.tmp"
["error"]=>
int(0)
}
}
}
```
That is instead of being part of array for each separate file, we now have an extra array with key
full_path, which lists all paths for all files being uploaded. I do not think this
works as intended.
### PHP Version
8.1.9
### Operating System
_No response_