From 24a23ee336c1135cd36874fdfa9dac0c9de1719c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gillet?= Date: Thu, 24 Feb 2022 10:48:32 +0100 Subject: [PATCH] Handle PHP 8.1 new $_FILES[full_path] array member --- lib/request/sfWebRequest.class.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/request/sfWebRequest.class.php b/lib/request/sfWebRequest.class.php index bf35cbcb4..431e85d04 100644 --- a/lib/request/sfWebRequest.class.php +++ b/lib/request/sfWebRequest.class.php @@ -872,7 +872,11 @@ static public function convertFileInformation(array $taintedFiles) */ static protected function fixPhpFilesArray(array $data) { - $fileKeys = array('error', 'name', 'size', 'tmp_name', 'type'); + if (version_compare(PHP_VERSION, '8.1.0-dev', '<')) { + $fileKeys = array('error', 'name', 'size', 'tmp_name', 'type'); + } else { + $fileKeys = array('error', 'full_path', 'name', 'size', 'tmp_name', 'type'); + } $keys = array_keys($data); sort($keys); @@ -889,11 +893,12 @@ static protected function fixPhpFilesArray(array $data) foreach (array_keys($data['name']) as $key) { $files[$key] = self::fixPhpFilesArray(array( - 'error' => $data['error'][$key], - 'name' => $data['name'][$key], - 'type' => $data['type'][$key], - 'tmp_name' => $data['tmp_name'][$key], - 'size' => $data['size'][$key], + 'error' => $data['error'][$key], + 'full_path' => $data['full_path'][$key], + 'name' => $data['name'][$key], + 'type' => $data['type'][$key], + 'tmp_name' => $data['tmp_name'][$key], + 'size' => $data['size'][$key], )); }