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

Add a magic isset method to pagelib.php moodle_page

    XMLWordPrintable

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • Future Dev
    • None
    • Other
    • None

    Description

      The moodle_page class uses magic methods for getting and setting properties.

      These magic methods lead to problems when trying to use isset on them. It provides results that are not expected.

      To avoid this "gotcha" it would be good to add a magic isset method to provide the expected outcome.

      Note: We discourage the use of magic method for precisely this reason.

      Proof of concept from Andrew:

      public function __isset($name): bool {
          return $this->__get($name) !== null;
       }
       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              abgreeve Adrian Greeve
              Adrian Greeve, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: