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

PHP 8.2: Dynamic Properties are deprecated for mod_assign

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Fixed
    • Icon: Critical Critical
    • 4.2
    • 4.2
    • Assignment
    • MOODLE_402_STABLE
    • MOODLE_402_STABLE
    • MDL-77343-master
    • Hide
      Prerequisite:

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

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

        git checkout 12a81769265a4fa75232ff1639423be1565c9fa9
        

      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 512M mod/assign
        

      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 512M mod/assign > 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 512M, or more if needed. Before test Check out and install a version of Moodle before the patch has been applied: git checkout 12a81769265a4fa75232ff1639423be1565c9fa9 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 512M mod/assign 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 512M mod/assign > 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/assign/ 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
            Raquel Ortega Raquel Ortega
            Jun Pataleta Jun Pataleta
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 48 minutes
                1d 48m

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