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

Changes to profile field signature causes fatal errors/documentation

XMLWordPrintable

    • MOODLE_400_STABLE, MOODLE_401_STABLE

      The work in MDL-76873 creates a backwards compatibility breaking change to the signature of  profile_field_base:is_visible() - in the stable branches at that.

      This unfortunately means that all profile field plugins that implement is_visible have to be updated before/during the upgrade to 4.0.7/4.1.2/4.2, otherwise you get fatal errors during the upgrade (and if you try and use the site afterwards).

      Fatal error: Declaration of profile_field_akindiid::is_visible() must be compatible with profile_field_base::is_visible(?context $context = null): bool in /var/www/other/major/user/profile/field/akindiid/field.class.php on line 53
      

      First thing I noticed was that user/profile/field/upgrade.txt doesn't have a note of this. user/upgrade.txt does, but that isn't technically the correct location (I'm ok with it being in both). I also think the wording that was put in user/upgrade.txt:

      The `profile_field_base::is_visible` method now accepts an optional `$context` argument

      is a bit understated for this - since every developer of a custom field plugin needs to update it if they use is_visible.

      If this hadn't been implemented on the stable branches, then it could have been detected by the environment checker, but I'm pretty sure that can't be done now.

      I also think this should also be called out specifically and boldly in the release notes (that ticket didn't even make the tickets list, but I think it should get a special callout at the top) - since it would be easy for end users/admins to end up in a state where they have a broken site while doing a minor point upgrade. Admins have to make sure that if they have any add on profile field plugins, that they either don't define is_visible(), or have the new signature before they upgrade their site.

            Unassigned Unassigned
            emerrill Eric Merrill
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

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