Closed (duplicate)
Project:
Drupal core
Version:
8.0.x-dev
Component:
configuration system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Dec 2012 at 19:11 UTC
Updated:
29 Jul 2014 at 21:36 UTC
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.
| Comment | File | Size | Author |
|---|---|---|---|
| config_import_5_4.patch | 778 bytes | chx |
Comments
Comment #1
moshe weitzman commentedComment #2
berdirOh 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()).
Comment #3
sunThis seems to have been fixed in another issue already.
Comment #3.0
sunUpdated issue summary.