Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
PHP 8 is strict when passing by reference into anonymous functions from array functions.
Steps to reproduce
Proposed resolution
Remove the &
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
N/a
Comment | File | Size | Author |
---|---|---|---|
#2 | 3173991-2.patch | 3.36 KB | alexpott |
Comments
Comment #2
alexpottComment #3
Gábor HojtsyDo we know why did we pass these by reference in the first place?
Comment #4
andypostIt looks like micro-optimization all this places using arrays to iterate but iterator is object which always passed by reference in PHP.
Maybe it was written before core started to use objects instead of arrays
I just wondered why sniffers/linters can't catch this yet
Comment #5
andypostComment #6
alexpottI think this is a copy and paste error from the original error. There's no optimisation going on. And the reference has no effect.
Comment #7
hussainwebThis is very similar to #3170648: CKEditorPluginManager::getEnabledButtons throws warnings on PHP 8.0.0 beta3 and as shown in the eval there, it is a definite behaviour change in PHP 8.
Comment #9
catchCommitted 0c707fd and pushed to 9.1.x. Thanks!