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

Fix known uses of null, bool, int, float or resource as array

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.8, 3.9
    • 3.8.1
    • General, Libraries
    • MOODLE_38_STABLE, MOODLE_39_STABLE
    • MOODLE_38_STABLE
    • Hide

      Not much to test here, because all the fixed cases have been detected via phpunit/behat/server logs. So, basically, verify that nothing is broken:

      1) travis is passing for php 7.1 & 7.3

      2) CI jobs also pass.

      3) Can run php 7.4 tests (locally or @ CI) and then look for "Trying to access array offset on value" remaining problems. But that has been already done (see the comment below were this was sent to peer-review).

      Ciao

      Show
      Not much to test here, because all the fixed cases have been detected via phpunit/behat/server logs. So, basically, verify that nothing is broken: 1) travis is passing for php 7.1 & 7.3 2) CI jobs also pass. 3) Can run php 7.4 tests (locally or @ CI) and then look for "Trying to access array offset on value" remaining problems. But that has been already done (see the comment below were this was sent to peer-review). Ciao

    Description

      . Trying to use values of type null, bool, int, float or resource as an
      array (such as $null["key"]) will now generate a notice. This does not
      affect array accesses performed by list().
      RFC: https://wiki.php.net/rfc/notice-for-non-valid-array-container

      This issue is about to detect as many uses of this type as possible and add the missing checks to avoid the notices. Note that, apart from the notice, the outcome remains BC, evaluating as null, so no change in the result is expected.

      We'll be using unit, acceptance and web server logs to detect wrong uses. It's not possible to detect them with regex/semantic searches, so some uses may remain hidden until detected in practice.

      WIP on this happening @ https://github.com/stronk7/moodle/compare/master...MDL-67114

      Attachments

        Issue Links

          Activity

            People

              stronk7 Eloy Lafuente (stronk7)
              stronk7 Eloy Lafuente (stronk7)
              Ferran Recio Ferran Recio
              Andrew Lyons Andrew Lyons
              Andrew Lyons Andrew Lyons
              Adrian Greeve, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                13/Jan/20

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 2 hours, 51 minutes
                  1d 2h 51m