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

validate_param() fails for PARAM_FLOAT

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.2.5, 2.3.2
    • Component/s: Libraries
    • Labels:

      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".

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  skodak Petr Skoda
                  Reporter:
                  mudrd8mz David Mudrák
                  Integrator:
                  Dan Poltawski
                  Tester:
                  Dan Poltawski
                  Participants:
                  Component watchers:
                  Ankit Agarwal, David Monllaó
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    10/Sep/12