Skip to content
  • Eloy Lafuente's avatar
    MDL-73824 gradebook: Stricter float check to some gradelib functions · e2821bf1
    Eloy Lafuente authored
    It has been detected that, right now, some localised floats are
    being passed to those functions (say comma separator, say thousands)
    and that's leading to all sort of problems later when comparing,
    processing or storing those "wrong-floats" (user entered).
    
    This just makes all those functions to be stricter, so any attempt
    of passing to them a wrong float will fail with a clear TypeError.
    
    Any existing case must be converted to a corrrect (X.Y) format, using
    unformat_float() or PARAM_LOCALISEDFLOAT before any processing.
    
    Localised floats cannot be used.
    
    Also, fix all the places where those functions are called from
    files having strict_types enabled because, with that, now float-like
    strings are not accepted any more. Luckily, there is only case,
    within the grade/classes/component_gradeitem.php file, and it has
    been fixed by casting the float-like string coming from DB to float.
    e2821bf1