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

array_filter() can not pass parameters by reference

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.10.1
    • 3.11
    • Repositories

    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

            marina Marina Glancy
            marina Marina Glancy
            Sujith Haridasan Sujith Haridasan
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            CiBoT CiBoT
            David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              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