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

PHP 8.2: Dynamic Properties are deprecated for mod_forum

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Fixed
    • Icon: Critical Critical
    • 4.2
    • 4.2
    • Forum
    • MOODLE_402_STABLE
    • MOODLE_402_STABLE
    • MDL-77344-master
    • Hide
      Prerequisite:

      The scanning process will consume memory resources. I suggest increasing the memory limit in your PHP.ini to 256M, or more if needed.

      Before test
      1. Check out and install a version of Moodle before the patch has been applied:

        git checkout 5e1df255667070445122c7822d21e66b2e0435fa
        

      2. Install PHPStan

        composer require --dev phpstan/phpstan
        

      3. Create phpstan.neon file in the moodle instance's root folder with the following contents:

        parameters:
            level: 6
            checkDynamicProperties: true 
        

      4. Generate a baseline file.

        vendor/bin/phpstan analyse --generate-baseline phpstan-baseline.php --memory-limit 256M mod/forum
        

      5. Update phpstan.neon with the following contents:

        includes:
           - phpstan-baseline.php
        parameters:
           level: 6
           checkDynamicProperties: true
        

      After patch
      1. Check out the version with the patch applied

        git checkout master

      2. Rerun the analysis:

        vendor/bin/phpstan analyse --memory-limit 256M mod/forum > result.txt
        

      3. Open the result.txt file.
      4. Search for "Access to an undefined property".
      5. Verify that all results are something like: "was not matched in reported errors".
      After the test
      1. Remember to delete/revert all the changes

        git reset --hard

      Show
      Prerequisite: The scanning process will consume memory resources. I suggest increasing the memory limit in your PHP.ini to 256M, or more if needed. Before test Check out and install a version of Moodle before the patch has been applied: git checkout 5e1df255667070445122c7822d21e66b2e0435fa Install PHPStan composer require --dev phpstan/phpstan Create phpstan.neon file in the moodle instance's root folder with the following contents: parameters: level: 6 checkDynamicProperties: true Generate a baseline file. vendor/bin/phpstan analyse --generate-baseline phpstan-baseline.php --memory-limit 256M mod/forum Update phpstan.neon with the following contents: includes: - phpstan-baseline.php parameters: level: 6 checkDynamicProperties: true After patch Check out the version with the patch applied git checkout master Rerun the analysis: vendor/bin/phpstan analyse --memory-limit 256M mod/forum > result.txt Open the result.txt file. Search for "Access to an undefined property". Verify that all results are something like: "was not matched in reported errors". After the test Remember to delete/revert all the changes git reset --hard
    • 2
    • 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

      This issue was created to fix all the PHP files inside the mod/forum/ folder related to dynamic properties deprecation on PHP 8.2.

      https://php.watch/versions/8.2/dynamic-properties-deprecated

            meirza.arson@moodle.com Meirza
            meirza.arson@moodle.com Meirza
            Huong Nguyen Huong Nguyen
            Jun Pataleta Jun Pataleta
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            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 - 3 hours, 29 minutes
                3h 29m

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