Moodle

Upgrade fails on some platforms becuase of fractional version numbers

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.9.3
  • Fix Version/s: 1.9.4
  • Component/s: Database SQL/XMLDB
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

See http://moodle.org/mod/forum/discuss.php?d=113752

The issue seems to be

(mysql): UPDATE mdl_config SET value = '2.0071E+9' WHERE name = 'version'

Note that the version number has been rounded (value = '2.0071E+9') so the upgrade continues from the wrong place.

http://www.php.net/manual/en/language.types.float.php seems to say that PHP floats always use 15 decimal digits of precision internally, so my diagnosis is that the error occurs when the float is converted to a string somewhere in set_config before it is stored in the DB.

Issue Links

Activity

Hide
Petr Škoda (skodak) added a comment -

going to add following into admin/index.php
$num1 = 2009010200.01;
$num2 = 2009010200.02;

if((string)$num1 === (string)$num2 or $num1 === $num2) {
error ('incorrect float handling detected');
}

Show
Petr Škoda (skodak) added a comment - going to add following into admin/index.php $num1 = 2009010200.01; $num2 = 2009010200.02; if((string)$num1 === (string)$num2 or $num1 === $num2) { error ('incorrect float handling detected'); }
Hide
Petr Škoda (skodak) added a comment -

I have committed a slightly improved detection code into cvs, this should prevent any data loss.
Now we need to describe the problem somewhere in installation docs...

Show
Petr Škoda (skodak) added a comment - I have committed a slightly improved detection code into cvs, this should prevent any data loss. Now we need to describe the problem somewhere in installation docs...
Hide
Petr Škoda (skodak) added a comment -
Show
Petr Škoda (skodak) added a comment - added small notice into installation FAQ - http://docs.moodle.org/en/Installation_FAQ#Moodle_claims_PHP_float_handling_is_not_compatible
Hide
Andrew Davis added a comment -

Closing.

Show
Andrew Davis added a comment - Closing.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: