Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.9.7
    • Fix Version/s: 1.9.8
    • Component/s: Libraries
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      The function s() contains the code

          if ($var == '0') {  // for integer 0, boolean false, string '0'
              return '0';
          }

      and it is all your fault Petr : http://cvs.moodle.org/moodle/lib/weblib.php?view=diff&r1=1.482&r2=1.483

      That screws up in the situation where you do

      $value = format_float($mark, 2); // e.g. $value = 0.00
      echo '<input type="text" value="' . s($value) . '" />';

      Actual result: the input contains 0
      Expected result: the input contains 0.00.

      (Of course, my real code is more complex than that. The call to s() is in html_writer.)

      I guess we need to change or remove that if in s().

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            skodak Petr Skoda added a comment -

            right, fixing!

            I am starting to hate == in PHP

            Show
            skodak Petr Skoda added a comment - right, fixing! I am starting to hate == in PHP
            Hide
            timhunt Tim Hunt added a comment -

            Thanks Petr.

            Show
            timhunt Tim Hunt added a comment - Thanks Petr.
            Hide
            skodak Petr Skoda added a comment -

            done, thanks a lot for the report

            Show
            skodak Petr Skoda added a comment - done, thanks a lot for the report
            Hide
            timhunt Tim Hunt added a comment -

            Thanks. That works.

            (First time I have QAed a Moodle bug on a train.)

            Show
            timhunt Tim Hunt added a comment - Thanks. That works. (First time I have QAed a Moodle bug on a train.)

              People

              • Assignee:
                skodak Petr Skoda
                Reporter:
                timhunt Tim Hunt
                Tester:
                Tim Hunt
                Participants:
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  25/Mar/10