diff --git a/src/Http/Controllers/CP/Assets/AssetsController.php b/src/Http/Controllers/CP/Assets/AssetsController.php index 2a1d5f7854..14b51f62c6 100644 --- a/src/Http/Controllers/CP/Assets/AssetsController.php +++ b/src/Http/Controllers/CP/Assets/AssetsController.php @@ -69,7 +69,7 @@ public function store(Request $request) 'container' => 'required', 'folder' => 'required', 'file' => ['file', function ($attribute, $value, $fail) { - if (in_array(trim(strtolower($value->getClientOriginalExtension())), ['php', 'php3', 'php4', 'php5', 'phtml'])) { + if (in_array(trim(strtolower($value->getClientOriginalExtension())), ['php', 'php3', 'php4', 'php5', 'php7', 'php8', 'phtml', 'phar'])) { $fail(__('validation.uploaded')); } }], diff --git a/src/Http/Controllers/CP/Fieldtypes/FilesFieldtypeController.php b/src/Http/Controllers/CP/Fieldtypes/FilesFieldtypeController.php index 44fec25302..4709f602da 100644 --- a/src/Http/Controllers/CP/Fieldtypes/FilesFieldtypeController.php +++ b/src/Http/Controllers/CP/Fieldtypes/FilesFieldtypeController.php @@ -12,7 +12,7 @@ public function upload(Request $request) { $request->validate([ 'file' => ['file', function ($attribute, $value, $fail) { - if (in_array(trim(strtolower($value->getClientOriginalExtension())), ['php', 'php3', 'php4', 'php5', 'phtml'])) { + if (in_array(trim(strtolower($value->getClientOriginalExtension())), ['php', 'php3', 'php4', 'php5', 'php7', 'php8', 'phtml', 'phar'])) { $fail(__('validation.uploaded')); } }], diff --git a/src/Http/Controllers/FormController.php b/src/Http/Controllers/FormController.php index 4db35e204c..8abb61c781 100644 --- a/src/Http/Controllers/FormController.php +++ b/src/Http/Controllers/FormController.php @@ -165,7 +165,7 @@ protected function extraRules($fields) }) ->mapWithKeys(function ($field) { return [$field->handle().'.*' => ['file', function ($attribute, $value, $fail) { - if (in_array(trim(strtolower($value->getClientOriginalExtension())), ['php', 'php3', 'php4', 'php5', 'phtml'])) { + if (in_array(trim(strtolower($value->getClientOriginalExtension())), ['php', 'php3', 'php4', 'php5', 'php7', 'php8', 'phtml', 'phar'])) { $fail(__('validation.uploaded')); } }]];