Although I should be all means refuse to touch config import, it affects my performance work so I need to fix it. Here's array_diff_assoc:

Two values from key => value pairs are considered equal only if (string) $elem1 === (string) $elem2 . In other words a strict check takes place so the string representations must be the same.

This string cast of arrays throws a notice on 5.4 and it's good it does because this is the wrong function to use here. We are not interested in the values at all, we want to get things to delete and things to create, right? Now, that is array_diff_key and not array_diff_assoc. Of course, knowing PHP is less important than lying about what I said.

Here's a patch.

CommentFileSizeAuthor
config_import_5_4.patch778 byteschx
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

moshe weitzman’s picture

Title: config import is broken » config import should use array_diff_key
Berdir’s picture

Oh nice, discovered the same thing (this throwing a notice in 5.4) but wasn't sure how to fix it: #1854540: Array to string conversion warnings for some tests with PHP 5.4 (does not yet fix this but a bunch of other cast to array notices). There is a similar use of array_diff_assoc() of javascript stuff, can you check and comment over there if array_diff_key() is the answer there as well? (Code is in CachePluginBase::gather_headers()).

sun’s picture

Status: Needs review » Closed (duplicate)

This seems to have been fixed in another issue already.

sun’s picture

Issue summary: View changes

Updated issue summary.