Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-76411 PHP 8.2: Dynamic Properties are deprecated
  3. MDL-78383

Redo PHP 8.2 fix for cache_config dynamic property

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Fixed
    • Icon: Minor Minor
    • 4.2.1
    • 4.2
    • Caching
    • MOODLE_402_STABLE
    • MOODLE_402_STABLE
    • MDL-78383_m402
    • Hide

      Copied testing instructions from original issue.

      Prerequisite:

      The scanning process will consume memory resources. it will consume about 1 GB, or more if needed.

      Run analysis

       # Install PHPStan

      composer require --dev phpstan/phpstan
      

       # Download : phpstan_mdl78383.neon and then put the file into Moodle's root folder.
       # Run the analysis:

      php -dmemory_limit=1G vendor/bin/phpstan analyse --configuration phpstan_mdl78383.neon -vvv | tee result.txt 

       # Search for "Access to an undefined property".

      grep -i "Access to an undefined property" result.txt  

       # Verify that you have an empty result.

      Show
      Copied testing instructions from original issue. Prerequisite: The scanning process will consume memory resources. it will consume about 1 GB, or more if needed. Run analysis  # Install PHPStan composer require --dev phpstan/phpstan  # Download : phpstan_mdl78383.neon and then put the file into Moodle's root folder.  # Run the analysis: php -dmemory_limit=1G vendor/bin/phpstan analyse --configuration phpstan_mdl78383.neon -vvv | tee result.txt  # Search for "Access to an undefined property". grep -i "Access to an undefined property" result.txt    # Verify that you have an empty result.
    • 1
    • Team Hedgehog Sprint 1 review, Team Hedgehog Sprint 2.1, Team Hedgehog Sprint 2.2, Team Hedgehog 2023 Sprint 1.3, Team Hedgehog 2023 Sprint 1.4, Team Hedgehog 2023 Sprint 2.0, Team Hedgehog 2023 Sprint 2.1, Team Hedgehog 2023 Sprint 2.2

      In MDL-77350, many PHP 8.2 dynamic property were addressed by defining the properties as part of the class. Unfortunately, the code being "fixed" sometimes was incorrectly written in the first place. Two of these items were caught before they were merged. The one that I am highlighting in this subtask is part of the cache_config class.

      meirza.arson@moodle.com has led the heroic task of addressing these ad-hoc class variable assignments and properly incorporating them into the class definition. The commit in question was  ebbf3bf357c7d599583cd3a62237bfd5483cea1d, and does address the immediate problem that configlockmappings was not defined in the cache_config class. However, when I was trying to determine how to fix this on my own PHP 8.2 install, I went searching to see how it was being used and noticed that configlockmappings is never used. Sure, it's assigned an empty array at one point, but that's it. It's as if the original author had an idea, wrote a stray line of code and the rest was history. That's all speculation of course and we've all done that.

            jrchamp Jonathan Champ
            jrchamp Jonathan Champ
            Meirza Meirza
            Andrew Lyons Andrew Lyons
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 26 minutes
                26m

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