Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-34538

validate_param() fails for PARAM_FLOAT

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.3
    • 2.2.5, 2.3.2
    • Libraries

    Description

      While developing a web service for my plugin, I realized that external_value(PARAM_FLOAT) does not accept 2.0 as a valid float. It turns out that it is a problem in validate_param() function. It uses

      if ((string)$param !== (string)$cleaned) {

      which apparently fails for 2.0 (original input) !== 2 (casted value).

      Škoďák commented this with: "right, we might need to use regex for this".

      Attachments

        Issue Links

          Activity

            People

              skodak Petr Skoda
              mudrd8mz David Mudrák (@mudrd8mz)
              Dan Poltawski Dan Poltawski
              Dan Poltawski Dan Poltawski
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                10/Sep/12