Moodle
  1. Moodle
  2. MDL-31167 PHP strict META
  3. MDL-32383

Error reported with PHP Strict for menu custom profile fields

    Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.2.2
    • Fix Version/s: None
    • Component/s: Administration
    • Labels:
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_22_STABLE
    • Rank:
      39239

      Description

      After logging in I encountered the following error.

      Strict Standards: Declaration of profile_field_menu::edit_save_data_preprocess() should be compatible with that of profile_field_base::edit_save_data_preprocess() in D:\xampp\htdocs\moodle_testing\user\profile\field\menu\field.class.php on line 104
      

      The base class has edit_save_data_preprocess() with two arguments while the function in the menu field extended class only has one. This problem doesn't seem to affect the other profile types. The only other type that overloads this function is textarea and that uses two arguments.

      To make this function in the menu field class compliant, I added a second argument (reference) and that resolved the error message.

      /**
       * The data from the form returns the key. This should be converted to the
       * respective option string to be saved in database
       * Overwrites base class accessor method
       * @param   integer   the key returned from the select input in the form
       * @param   mixed     parameter required to satisfy overloading requirements
       */
      function edit_save_data_preprocess($key, &$ignore) {
          return isset($this->options[$key]) ? $this->options[$key] : NULL;
      }
      

        Issue Links

          Activity

          Hide
          Petr Škoda added a comment -

          thanks for the report

          Show
          Petr Škoda added a comment - thanks for the report

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: