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

array_filter() can not pass parameters by reference

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.10.1
    • Fix Version/s: 3.11
    • Component/s: Repositories
    • Labels:

      Description

      PHP8 shows exceptions about it

      Exception - Warning: repository::filter(): Argument #1 ($value) must be passed by reference, value given in [dirroot]/repository/user/lib.php on line 140
      URL: http://webserver/
      Debug info: Error code: generalexceptionmessage
      Stack trace:
       
      * line 157 of /lib/behat/lib.php: Exception thrown
      * line ? of unknownfile: call to behat_error_handler()
      * line 140 of /repository/user/lib.php: call to array_filter()
      * line 102 of /repository/repository_ajax.php: call to repository_user->get_listing()
      

      From PHP8 change-logs:

      Any functions accepting callbacks that are not explicitly specified to
      accept parameters by reference will now warn if a callback with reference
      parameters is used. Examples include array_filter() and array_reduce().
      This was already the case for most, but not all, functions previously.

        Attachments

          Activity

            People

            Assignee:
            marina Marina Glancy
            Reporter:
            marina Marina Glancy
            Peer reviewer:
            Sujith Haridasan Sujith Haridasan
            Integrator:
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Tester:
            CiBoT CiBoT
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
            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 - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 45 minutes
                1h 45m