validators file_validate_extensions not exist

Created on 7 March 2024, 9 months ago
Updated 16 March 2024, 8 months ago

Problem/Motivation

Install module with drupal 10.2.x

Steps to reproduce

File widget can't validate all file upload

Warning : Undefined array key "file_validate_extensions" dans Drupal\plupload_widget\Plugin\Field\FieldWidget\FileWidget::process() (C:\Users\www\aphp\web\modules\contrib\plupload_widget\src\Plugin\Field\FieldWidget\FileWidget.php ligne 64)
#0 C:\Users\www\aphp\web\core\includes\bootstrap.inc(164): _drupal_error_handler_real(2, 'Undefined array...', 'C:\\Users\\...', 64)
#1 C:\Users\www\aphp\web\modules\contrib\plupload_widget\src\Plugin\Field\FieldWidget\FileWidget.php(64): _drupal_error_handler(2, 'Undefined array...', 'C:\\Users\\...', 64)

i think in drupal 10.2 file_validate_extensions is not exist replace by
$configuration->validators["FileExtension"]["extensions"]

Proposed resolution

just change

 'file_validate_extensions' => [$configuration->validators['file_validate_extensions'] ?? $configuration->validators["FileExtension"]["extensions"]],

Attention i see in modules/contrib/plupload/src/Element/PlUploadFile.php
it call $extensions = $element['#upload_validators']['file_validate_extensions'][0];
it means file_validate_extensions must be array not string;

🐛 Bug report
Status

Closed: duplicate

Version

2.0

Component

Code

Created by

🇫🇷France lazzyvn paris

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024