Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-31167 PHP strict META
  3. MDL-38545

PHP Strict Standards error: graph.php on line 194

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4.3, 2.5
    • Fix Version/s: 2.4.5, 2.5.1
    • Component/s: Reports
    • Labels:
    • Testing Instructions:
      Hide

      (difficulty: easy, requires access to activity reports)

      1. Visit _Home ► My profile settings ► Activity reports ► Today's logs
      2. The graph is displayed and no PHP error is written into the logs
      Show
      (difficulty: easy, requires access to activity reports) Visit _Home ► My profile settings ► Activity reports ► Today's logs The graph is displayed and no PHP error is written into the logs
    • Affected Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      m25_MDL-38545_PHP_Strict_error

      Description

      When visiting Home ► My profile settings ► Activity reports ► Today's logs the graph is not displayed and the PHP error log tells about it:

      PHP Strict Standards:  Creating default object from empty value
      in /path/to/report/log/graph.php on line 194
      

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            matteo Matteo Scaramuccia added a comment -

            The fix is quite simple:

            diff --git a/report/log/graph.php b/report/log/graph.php
            index 842f847..58a49cb 100644
            --- a/report/log/graph.php
            +++ b/report/log/graph.php
            @@ -130,6 +130,7 @@ if ($type === "usercourse.png") {
             
                $graph = new graph(750, 400);
             
            +   $a = new stdClass();
                $a->coursename = format_string($course->shortname, true, array('context' => $coursecontext));
                $a->username = fullname($user, true);
                $graph->parameter['title'] = get_string("hitsoncourse", "", $a);
            @@ -191,6 +192,7 @@ if ($type === "usercourse.png") {
             
                $graph = new graph(750, 400);
             
            +   $a = new stdClass();
                $a->coursename = format_string($course->shortname, true, array('context' => $coursecontext));
                $a->username = fullname($user, true);
                $graph->parameter['title'] = get_string("hitsoncoursetoday", "", $a);

            I'm wondering if this could be an error pattern: I'll search for it.

            Show
            matteo Matteo Scaramuccia added a comment - The fix is quite simple: diff --git a/report/log/graph.php b/report/log/graph.php index 842f847..58a49cb 100644 --- a/report/log/graph.php +++ b/report/log/graph.php @@ -130,6 +130,7 @@ if ($type === "usercourse.png") {   $graph = new graph(750, 400);   + $a = new stdClass(); $a->coursename = format_string($course->shortname, true, array('context' => $coursecontext)); $a->username = fullname($user, true); $graph->parameter['title'] = get_string("hitsoncourse", "", $a); @@ -191,6 +192,7 @@ if ($type === "usercourse.png") {   $graph = new graph(750, 400);   + $a = new stdClass(); $a->coursename = format_string($course->shortname, true, array('context' => $coursecontext)); $a->username = fullname($user, true); $graph->parameter['title'] = get_string("hitsoncoursetoday", "", $a); I'm wondering if this could be an error pattern: I'll search for it.
            Hide
            salvetore Michael de Raadt added a comment -

            I noticed this warning appearing in 2.4 and master, so it's not a new issue.

            Show
            salvetore Michael de Raadt added a comment - I noticed this warning appearing in 2.4 and master, so it's not a new issue.
            Hide
            skodak Petr Skoda added a comment -

            +1

            Show
            skodak Petr Skoda added a comment - +1
            Hide
            matteo Matteo Scaramuccia added a comment -

            Hi Eloy,
            would you like me to rebase it and to add the new missing 2.5 branch? I've planned to do that this night or the next but maybe it could be too late for your schedule.

            Matteo

            Show
            matteo Matteo Scaramuccia added a comment - Hi Eloy, would you like me to rebase it and to add the new missing 2.5 branch? I've planned to do that this night or the next but maybe it could be too late for your schedule. Matteo
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Integrated (24, 25 and master), thanks!

            Thanks Matteo, I've cherry-picked it, np.

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Integrated (24, 25 and master), thanks! Thanks Matteo, I've cherry-picked it, np.
            Hide
            rwijaya Rossiani Wijaya added a comment -

            This is working as expected.

            Tested for 2.4, 2.5 and master.

            Test passed.

            Show
            rwijaya Rossiani Wijaya added a comment - This is working as expected. Tested for 2.4, 2.5 and master. Test passed.
            Hide
            poltawski Dan Poltawski added a comment -

            Feature: Thanks to our superb contributors
              In order to make Moodle better
              As an integrator
              I need to thank all our contributors
             
              Scenario: Dan thanks you all
                Given I log in as "dan"
                And I see "lots of fixed issues"
                When I follow "Close integrated issues"
                Then I should see "Lots of thanks to all our contributors"
            

            Your changes are upstream

            Show
            poltawski Dan Poltawski added a comment - Feature: Thanks to our superb contributors In order to make Moodle better As an integrator I need to thank all our contributors   Scenario: Dan thanks you all Given I log in as "dan" And I see "lots of fixed issues" When I follow "Close integrated issues" Then I should see "Lots of thanks to all our contributors" Your changes are upstream

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  8/Jul/13