Issue Details (XML | Word | Printable)

Key: MDL-17868
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Petr Skoda
Reporter: Tim Hunt
Votes: 0
Watchers: 0
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Upgrade fails on some platforms becuase of fractional version numbers

Created: 13/Jan/09 05:33 PM   Updated: 15/Feb/09 03:15 PM
Return to search
Component/s: Database SQL/XMLDB
Affects Version/s: 1.9.3
Fix Version/s: 1.9.4

Issue Links:
Cloners
 

Participants: Petr Skoda and Tim Hunt
Security Level: None
Resolved date: 22/Jan/09
Affected Branches: MOODLE_19_STABLE
Fixed Branches: MOODLE_19_STABLE


 Description  « Hide
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.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Petr Skoda added a comment - 13/Jan/09 05:36 PM
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');
}


Petr Skoda added a comment - 13/Jan/09 06:06 PM
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...

Petr Skoda added a comment - 22/Jan/09 02:30 AM