From 7fd31fe86c4acc4b8ed5968ac4118340c6033243 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Mon, 19 Mar 2012 20:48:48 +0100 Subject: [PATCH] MDL-32112 horrible hack that ignores invalid size for XMLDB_TYPE_NUMBER in numerical question type The easies fix could be to use VARCHAR instead because this field is used only for reading and writing, no selects on this field it seems. --- lib/xmldb/xmldb_field.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/xmldb/xmldb_field.php b/lib/xmldb/xmldb_field.php index 1a746943c2d..4b325df76e4 100644 --- a/lib/xmldb/xmldb_field.php +++ b/lib/xmldb/xmldb_field.php @@ -726,8 +726,13 @@ class xmldb_field extends xmldb_object { break; case XMLDB_TYPE_NUMBER: + $maxlength = 20; + if ($xmldb_table->getName() === 'question_numerical_units' and $name === 'multiplier') { + //TODO: remove after MDL-32113 is resolved + $maxlength = 40; + } $length = $this->getLength(); - if (!is_number($length) or $length <= 0 or $length > 20) { + if (!is_number($length) or $length <= 0 or $length > $maxlength) { return 'Invalid field definition in table {'.$xmldb_table->getName(). '}: XMLDB_TYPE_NUMBER field "'.$this->getName().'" has invalid length'; } $decimals = $this->getDecimals();