Problem/Motivation

The code in rebuild.php to clear the user local caches has a couple of issues.

1. array_walk accepts the first array parameter by reference, so not passing a variable here generates warnings
2. array_walk passes the value as the first parameter and the key and the second to the callback function. So in PHP7 the call to apcu_clear_cache() is meant to have 0 parameters but it does not.

See https://3v4l.org/pS2ru for an example of this.

Proposed resolution

Use array_map instead, this was initially a problem in drush, see https://github.com/drush-ops/drush/pull/2451

Remaining tasks

User interface changes

n/a

API changes

n/a

Data model changes

n/a

CommentFileSizeAuthor
#2 2829578.patch451 bytesdamiankloip
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

damiankloip created an issue. See original summary.

damiankloip’s picture

damiankloip’s picture

Title: Rebuild.php script has » Rebuild.php script uses array_walk incorrectly
damiankloip’s picture

Issue summary: View changes
damiankloip’s picture

Status: Active » Needs review
slasher13’s picture

Status: Needs review » Reviewed & tested by the community

  • catch committed 4e24aeb on 8.3.x
    Issue #2829578 by damiankloip: Rebuild.php script uses array_walk...
catch’s picture

Version: 8.3.x-dev » 8.2.x-dev
Status: Reviewed & tested by the community » Needs work

Committed/pushed to 8.3.x, but this doesn't apply to 8.2.x so needs a re-roll.

damiankloip’s picture

Catch, 8.2.x only tries to clear the APCu code, so this fix doesn't really apply. Unless we want to port the support for the other caches over too? But that would have been done in the original patch if so?

catch’s picture

Version: 8.2.x-dev » 8.3.x-dev
Status: Needs work » Fixed

No that's fine I just didn't remember this hunk was only in 8.3.x, and didn't look at 8.2.x to see why it didn't apply. If we did have that code it would've been eligible...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.