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

Declaration of read_slave_moodle_database::set_db_handle($dbh) is not compatible with the trait

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.10.1, 3.11, 4.0
    • Fix Version/s: 3.11
    • Component/s: Database SQL/XMLDB
    • Labels:

      Description

      PHP Fatal error:  Declaration of read_slave_moodle_database::set_db_handle($dbh) must be compatible with 
      moodle_read_slave_trait::set_db_handle($dbh): void 
      in /home/marina/repositories/lms/master/moodle/lib/dml/tests/fixtures/read_slave_moodle_database.php on line 203
      

      Information, new in PHP8:

      The signature of abstract methods defined in traits is now checked against
      the implementing class method:

              trait MyTrait {
                  abstract private function neededByTrait(): string;
              }
       
              class MyClass {
                  use MyTrait;
       
                  // Error, because of return type mismatch.
                  private function neededByTrait(): int { return 42; }
              }
      

      RFC: https://wiki.php.net/rfc/abstract_trait_method_validation

        Attachments

          Activity

            People

            Assignee:
            marina Marina Glancy
            Reporter:
            marina Marina Glancy
            Peer reviewer:
            Amaia Anabitarte Amaia Anabitarte
            Integrator:
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Tester:
            CiBoT CiBoT
            Participants:
            Component watchers:
            Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              17/May/21

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 5 minutes
                2h 5m