Skip to content

Commit b15044c

Browse files
committed
Handle PHP 8.1 new $_FILES[full_path] array member
1 parent 946a243 commit b15044c

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

lib/request/sfWebRequest.class.php

+11-6
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,11 @@ static public function convertFileInformation(array $taintedFiles)
872872
*/
873873
static protected function fixPhpFilesArray(array $data)
874874
{
875-
$fileKeys = array('error', 'name', 'size', 'tmp_name', 'type');
875+
if (version_compare(PHP_VERSION, '8.1.0-dev', '<')) {
876+
$fileKeys = array('error', 'name', 'size', 'tmp_name', 'type');
877+
} else {
878+
$fileKeys = array('error', 'full_path', 'name', 'size', 'tmp_name', 'type');
879+
}
876880
$keys = array_keys($data);
877881
sort($keys);
878882

@@ -889,11 +893,12 @@ static protected function fixPhpFilesArray(array $data)
889893
foreach (array_keys($data['name']) as $key)
890894
{
891895
$files[$key] = self::fixPhpFilesArray(array(
892-
'error' => $data['error'][$key],
893-
'name' => $data['name'][$key],
894-
'type' => $data['type'][$key],
895-
'tmp_name' => $data['tmp_name'][$key],
896-
'size' => $data['size'][$key],
896+
'error' => $data['error'][$key],
897+
'full_path' => $data['full_path'][$key],
898+
'name' => $data['name'][$key],
899+
'type' => $data['type'][$key],
900+
'tmp_name' => $data['tmp_name'][$key],
901+
'size' => $data['size'][$key],
897902
));
898903
}
899904

0 commit comments

Comments
 (0)