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

Fix known cases of creating objects from empty value

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.8.1
    • 3.8, 3.9
    • General
    • MOODLE_38_STABLE, MOODLE_39_STABLE
    • MOODLE_38_STABLE
    • Hide
      1. Confirm that php71 and php73 unit tests are passing with this patch (travis tells you). Nothing to do here - travis is passing.
      2. Confirm that a php74 phpunit and behat runs does not return any* "creating default object from empty value". Can use a DEV job to verify that, php74-rc is available there. Otherwise, do a full run of phpunit on 7.4, passing the output to a file which you can search afterwards.
      • Note: there is one exception to this, and it's MDL-66259 that is being handled separately. With that issue still not integrated it's possible to find the "creating default object from empty value" happening for some qtypes (multianswer). If those are the unique cases, that's ok for this issue.
      • Note2: under php74 there are still lots of errors. Ignore them 100%. Here we are only interested about the "creating default object from empty value" ones.
      Show
      Confirm that php71 and php73 unit tests are passing with this patch (travis tells you). Nothing to do here - travis is passing. Confirm that a php74 phpunit and behat runs does not return any* "creating default object from empty value". Can use a DEV job to verify that, php74-rc is available there. Otherwise, do a full run of phpunit on 7.4, passing the output to a file which you can search afterwards. Note: there is one exception to this, and it's MDL-66259 that is being handled separately. With that issue still not integrated it's possible to find the "creating default object from empty value" happening for some qtypes (multianswer). If those are the unique cases, that's ok for this issue. Note2: under php74 there are still lots of errors. Ignore them 100%. Here we are only interested about the "creating default object from empty value" ones.

      From PHP 7.4 upgrading info:

      The "creating default object from empty value" warning is now consistently
      thrown if a falsy value is promoted into an stdClass object. Previously some
      cases like `$null->prop[0] = $val` missed this warning.

      Main problem with this issue is that it's impossible to detect all cases programmatically and we only can fix them while they happen (right now, with phpunit and behat executions).

      So, hoping that coverage will unveil the majority of them and knowing that this change doesn't lead to any fatal error (but "just" warnings) that's the approach we are going to follow:

      • Impossible to detect in advance.
      • Fix all uses found via automated testing.
      • Remaining cases will be fixed when discovered (if any).

            stronk7 Eloy Lafuente (stronk7)
            stronk7 Eloy Lafuente (stronk7)
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Jake Dallimore Jake Dallimore
            Gladys Basiana Gladys Basiana
            Votes:
            0 Vote for this issue
            Watchers:
            4 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, 55 minutes
                2h 55m

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