From 17d1174bcbc1d70c5d0e2da64bb9a7e5b7ea8d4d Mon Sep 17 00:00:00 2001 From: Moritz Profitlich Date: Tue, 9 May 2023 12:13:23 +0200 Subject: [PATCH 1/2] PHP 8.2 compatibility --- extension.meta.xml | 3 +++ fields/field.reflectedupload.php | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/extension.meta.xml b/extension.meta.xml index fc449e8..e137310 100644 --- a/extension.meta.xml +++ b/extension.meta.xml @@ -16,6 +16,9 @@ + + * PHP 8.2 compatibility + * Fixed broken error messages ([#13](https://github.com/twiro/reflecteduploadfield/issues/13)) * Removed obsolete function 'getUniqueFilename' diff --git a/fields/field.reflectedupload.php b/fields/field.reflectedupload.php index 129145c..449a504 100644 --- a/fields/field.reflectedupload.php +++ b/fields/field.reflectedupload.php @@ -57,7 +57,7 @@ public function displaySettingsPanel(XMLElement &$wrapper , $errors = null) $label->appendChild($help); if (isset($errors['expression'])) { - $wrapper->appendChild(Widget::wrapFormElementWithError($label , $errors['expression'])); + $wrapper->appendChild(Widget::Error($label , $errors['expression'])); } else { $wrapper->appendChild($label); } @@ -107,7 +107,11 @@ public function commit() $fields = array(); $fields['field_id'] = $id; $fields['destination'] = $this->get('destination'); - $fields['validator'] = ($fields['validator'] == 'custom' ? NULL : $this->get('validator')); + if (in_array('validator', $fields)) { + $fields['validator'] = ($fields['validator'] == 'custom' ? NULL : $this->get('validator')); + } else { + $fields['validator'] = $this->get('validator'); + } $fields['expression'] = $this->get('expression'); $fields['unique'] = $this->get('unique'); $fields['unique'] = ($this->get('unique') ? 1 : 0); From a833daf7bc85f8ddd87eab200d25955ccae8c766 Mon Sep 17 00:00:00 2001 From: Moritz Profitlich Date: Tue, 9 May 2023 13:40:08 +0200 Subject: [PATCH 2/2] Correction of variable name previousVersion --- extension.driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension.driver.php b/extension.driver.php index 2865d66..9210fb4 100644 --- a/extension.driver.php +++ b/extension.driver.php @@ -142,7 +142,7 @@ public function update($previousVersion = false) } // updating from versions prior to 1.2 - if (version_compare($previous_version, '1.2', '<')) { + if (version_compare($previousVersion, '1.2', '<')) { // Remove directory from the upload fields, fixes Symphony Issue #1719 $upload_tables = Symphony::Database()->fetchCol("field_id", "SELECT `field_id` FROM `tbl_fields_reflectedupload`");