From b60d42e92a737e6cbb3366106db7a7b95c93965d Mon Sep 17 00:00:00 2001 From: Stevani Andolo Date: Thu, 22 Feb 2024 12:46:46 +0800 Subject: [PATCH] MDL-80827 tool_xmldb: Fixed xmldb editor broken with PHP 8.1 --- .../xmldb/actions/edit_field_save/edit_field_save.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/tool/xmldb/actions/edit_field_save/edit_field_save.class.php b/admin/tool/xmldb/actions/edit_field_save/edit_field_save.class.php index 40bbeee44c9..67ddf045edf 100644 --- a/admin/tool/xmldb/actions/edit_field_save/edit_field_save.class.php +++ b/admin/tool/xmldb/actions/edit_field_save/edit_field_save.class.php @@ -91,12 +91,12 @@ class edit_field_save extends XMLDBAction { $comment = trim($comment); $type = required_param('type', PARAM_INT); - $length = strtolower(optional_param('length', NULL, PARAM_ALPHANUM)); + $length = optional_param('length', null, PARAM_INT); $decimals = optional_param('decimals', NULL, PARAM_INT); $notnull = optional_param('notnull', false, PARAM_BOOL); $sequence = optional_param('sequence', false, PARAM_BOOL); $default = optional_param('default', NULL, PARAM_PATH); - $default = trim($default); + $default = is_null($default) ? $default : trim($default); $editeddir = $XMLDB->editeddirs[$dirpath]; $structure = $editeddir->xml_file->getStructure();