Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.4, 2.3.1, 2.4
    • Fix Version/s: 2.2.5, 2.3.2
    • Component/s: Quiz
    • Labels:
    • Testing Instructions:
      Hide

      [If a tester with php 5.4 can be found, this would be best, but regression testing on <5.4 is also sufficient]

      1. For a quiz with attempts, go to Results -> Grades in the navigation.

      2. Verify that the graph at the bottom of the page appears.

      Show
      [If a tester with php 5.4 can be found, this would be best, but regression testing on <5.4 is also sufficient] 1. For a quiz with attempts, go to Results -> Grades in the navigation. 2. Verify that the graph at the bottom of the page appears.
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      43023

      Description

      Matthew Davidson reported in MDL-34164:

      After some testing, the problem seems to be with the line in reportlib.php, function quiz_report_grade_bands():

      unset($data[$bands]);

      There is definitely a PHP 5.4 issue here. I have made a small script to show this issue. I'll submit it to PHP to get this fixed. It has something to do with how $bands or $foo in this case is cast. It starts as a string, then becomes a double, but something is wrong with it because if you cast the variable as anything the unset() statement will work as intended. Event casting it as a double works:

      $test = array("5"=>"bar");
      $foo = "10.0000"; // gettype($foo) = "string"
      $foo /= 2; //Makes $foo = 5 but still gettype($foo) = "double"
      echo gettype($foo);
      unset($test[$foo]);

      However, if Moodle would like to be proactive in this, it could be fixed on your end by casting the variable $bands like so...

      unset($data[(int) $bands]);

        Issue Links

          Activity

          Hide
          Tim Hunt added a comment -

          Would be good if someone who was experiencing the problem in PHP 5.4 could test the patch. Thanks.

          Show
          Tim Hunt added a comment - Would be good if someone who was experiencing the problem in PHP 5.4 could test the patch. Thanks.
          Hide
          Matthew Davidson added a comment -

          tested...works

          Show
          Matthew Davidson added a comment - tested...works
          Hide
          Dan Poltawski added a comment -

          Integrated, thanks guys

          Show
          Dan Poltawski added a comment - Integrated, thanks guys
          Hide
          David Monllaó added a comment -

          It passes. MOODLE_22_STABLE and master tested with PHP 5.3, master also tested in a VM with PHP 5.4. The graphs are generated in both versions of PHP

          Show
          David Monllaó added a comment - It passes. MOODLE_22_STABLE and master tested with PHP 5.3, master also tested in a VM with PHP 5.4. The graphs are generated in both versions of PHP
          Hide
          Dan Poltawski added a comment -

          asko, Дзякуй, ধন্যবাদ, Благодаря, Gràcies, 感谢, 謝謝, Hvala, Díky, Tak, Bedankt, Tänan, متشکریم, Salamat, Kiitokset, Merci, Grazas, Danke, Ευχαριστώ, આભાર, תודה, धन्यवाद, Köszönjük, Takk fyrir, Terima Kasih, Grazie, ありがとうございます, Рахмет, សូមអរគុណ, 감사합니다, gratiās, Pateicamies, Ačiū, Благодарам, Tēnā koa, Kia Ora Rawa Atu, आभारी आहोत, Талархал, Takk, Dziękuję, Obrigado, Mulţumesc, Engraziel, Спасибо, Fa'afetai, Хвала, Hvala, ස්තූතියි, Vďaka, Hvala, Mahadsanid, Thanks, Gracias, Tack, Salamat, நன்றி, నెనరులు, ขอบคุณค่ะ!

          Your work has made it into this weeks Moodle release! There are no gold medals available this week - but millions around the world will benefit. Thank you!

          Show
          Dan Poltawski added a comment - asko, Дзякуй, ধন্যবাদ, Благодаря, Gràcies, 感谢, 謝謝, Hvala, Díky, Tak, Bedankt, Tänan, متشکریم, Salamat, Kiitokset, Merci, Grazas, Danke, Ευχαριστώ, આભાર, תודה, धन्यवाद, Köszönjük, Takk fyrir, Terima Kasih, Grazie, ありがとうございます, Рахмет, សូមអរគុណ, 감사합니다, gratiās, Pateicamies, Ačiū, Благодарам, Tēnā koa, Kia Ora Rawa Atu, आभारी आहोत, Талархал, Takk, Dziękuję, Obrigado, Mulţumesc, Engraziel, Спасибо, Fa'afetai, Хвала, Hvala, ස්තූතියි, Vďaka, Hvala, Mahadsanid, Thanks, Gracias, Tack, Salamat, நன்றி, నెనరులు, ขอบคุณค่ะ! Your work has made it into this weeks Moodle release! There are no gold medals available this week - but millions around the world will benefit. Thank you!

            People

            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: