Replace FileUploadHandler:: handleFileUpload() switch with match when core requires PHP 8

Created on 13 October 2021, over 2 years ago
Updated 12 December 2023, 7 months ago

Problem/Motivation

Coming from #3232248-54: Move _file_save_upload_single to a service and deprecate β†’

Steps to reproduce

+++ b/core/modules/file/src/Upload/FileUploadHandler.php
@@ -0,0 +1,134 @@
+    switch ($uploadedFile->getError()) {
+      case \UPLOAD_ERR_INI_SIZE:
...
+      case \UPLOAD_ERR_FORM_SIZE:
...
+      case \UPLOAD_ERR_PARTIAL:
...
+      case \UPLOAD_ERR_NO_FILE:
...
+      case \UPLOAD_ERR_NO_TMP_DIR:
...
+      case \UPLOAD_ERR_CANT_WRITE:
...
+      case \UPLOAD_ERR_EXTENSION:
...
+    throw new FileException($uploadedFile->getErrorMessage());

Proposed resolution

Use https://www.php.net/manual/en/control-structures.match.php

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Closed: won't fix

Version

10.0 ✨

Component
File systemΒ  β†’

Last updated about 3 hours ago

Created by

πŸ‡«πŸ‡·France andypost

Live updates comments and jobs are added and updated live.
  • PHP 8.0

    The issue particularly affects sites running on PHP version 8.0.0 or later.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024