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`"); 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);