MDL-63252 tool_xmldb: convert default to float to avoid false positives

This commit is contained in:
Sam Marshall
2020-07-24 07:53:19 +08:00
committed by Simey Lameze
parent 94fdac9117
commit 3d03d2a0d4
@@ -93,6 +93,17 @@ class check_defaults extends XMLDBCheckAction {
$physicaldefault = null;
}
// For number fields there are issues with type differences, so let's convert
// everything to a float.
if ($xmldbfield->getType() === XMLDB_TYPE_NUMBER) {
if ($physicaldefault !== null) {
$physicaldefault = (float) $physicaldefault;
}
if ($xmldbdefault !== null) {
$xmldbdefault = (float) $xmldbdefault;
}
}
// There *is* a default and it's wrong.
if ($physicaldefault !== $xmldbdefault) {
$xmldbtext = self::display_default($xmldbdefault);