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

PHP 8.2: Dynamic Properties are deprecated for questionbase.php

    XMLWordPrintable

Details

    • 5
    • 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

    Description

      This issue follows on from MDL-77299 & MDL-77327, fixing the PHP 8.2 "Deprecated: Creation of dynamic property ... is deprecated in ...".

      There are three remaining problems, with the fixes worked out by meirza.arson@moodle.com and rezaie9.

      A) qtype_truefalse_questoin fails to declare the properties

      public $truefeedbackformat;
      public $falsefeedbackformat;
      public $showstandardinstruction;
      

      B) qtype_multianswer was using the undeclared property ->maxmark on subquestions. We can fix that by switching to (re)using the declared property ->defaultmark for the same purpose.

      C) There were two problems with the qtype_numerical_answer class:

      C1) qtype_calculated was re-using the class qtype_numerical_answer and setting two additional properites that were not declared. The fix was to define and use a nwe class qtype_calculated_answer.

      C2) During the grading in qtype_numerical, some undeclared properties were used to track bits of the calculation. This was fixed using a replace temp with query refactoring.

      Original descripion follows:


      This issue focuses on these files:

      • question/type/questionbase.php

      Please see question_answer.txt to see the errors from PHPUnit testing.

      Other than that. These properties also need to include in the class question_definition because qtype_truefalse::initialise_question_instance needs all the properties.

      public $rightanswer;
      public $truefeedback;
      public $falsefeedback;
      public $trueanswerid;
      public $falseanswerid;
      public $truefeedbackformat;
      public $falsefeedbackformat;
      public $showstandardinstruction;
      public $maxmark;

       

      Attachments

        Issue Links

          Activity

            People

              rezaie9 Shamim Rezaie
              meirza.arson@moodle.com Meirza
              Tim Hunt Tim Hunt
              Jun Pataleta Jun Pataleta
              CiBoT CiBoT
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 days, 2 hours, 22 minutes
                  3d 2h 22m

                  Clockify

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