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

TypeError in progress_bar->update_raw() when OS locale's decimal separator is comma

XMLWordPrintable

      If the locale for sprintf() uses comma for the decimal separator then the following error occurs when Reset Dashboard for all users is clicked:

      Exception - core\output\core_renderer::render_progress_bar_update(): Argument #2 ($percent) must be of type float, string given, called in [dirroot]/lib/classes/output/progress_bar.php on line 184

      More information about this error
      Debug info:
      Error code: generalexceptionmessage
      Stack trace:

          line 4766 of /lib/classes/output/core_renderer.php: TypeError thrown
          line 184 of /lib/classes/output/progress_bar.php: call to core\output\core_renderer->render_progress_bar_update()
          line 222 of /lib/classes/output/progress_bar.php: call to core\output\progress_bar->update_raw()
          line 234 of /lib/classes/output/progress_bar.php: call to core\output\progress_bar->update_full()
          line 313 of /my/lib.php: call to core\output\progress_bar->update()
          line 70 of /my/indexsys.php: call to my_reset_page_for_all_users()

      Steps to reproduce issue

      1. Set up a Moodle 4.5 site.

      2. If your locale uses '.' as the decimal separator: edit lib/classes/output/progress_bar.php adding the setlocale() call below:

      183         if ($this->autoupdate) {
      184             setlocale(LC_ALL, 'pt_BR.UTF-8');
      185             echo $OUTPUT->render_progress_bar_update($this->idnumber, sprint    f("%.1f", $this->percent), $msg, $estimatemsg);

      3. Go to Site administration > Appearance > Default Dashboard page.

      4. Click Reset Dashboard for all users.

      Expected results

      Message All Dashboard pages have been reset to default with progress bar at 100%.

      Actual results

      Error Exception - core\output\core_renderer::render_progress_bar_update(): Argument #2 ($percent) must be of type float, string given, called in [dirroot]/lib/classes/output/progress_bar.php on line 185.

        1. 84072.patch
          1 kB
        2. MDL-84072.png
          MDL-84072.png
          234 kB

            pholden Paul Holden
            leonstr Leon Stringer
            Pedro Jordao Pedro Jordao
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 56 minutes
                2h 56m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.