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
0
is a valid array key but the ListElement
strips this key which leads to a fatal error and invalid config.
Proposed resolution
Use ltrim() instead of array_filter() in ListElement
.
Remaining tasks
User interface changes
API changes
Suggested commit message
git commit -m 'Issue #2395627 by webflo, Leksat: Do not remove 0 from config translation data'
Beta phase evaluation
Issue category | Bug because Config Translation does not work for sequences with multiple items, field default values, for example. |
---|---|
Issue priority | Not critical because Drupal is fully functional even with this bug and it is more a 5% use-case that hits bug |
Unfrozen changes | Not unfrozen |
Prioritized changes | This is a prioritized change because it is a bug |
Disruption | No disruption. (Even modules heavily altering Config Translation's forms will only break under absurd circumstances; instead they will notice that they have one bug less, that they didn't know they had) |
Comment | File | Size | Author |
---|---|---|---|
#21 | 2395627-20-v2.patch | 4.81 KB | Gábor Hojtsy |
#20 | 2395627-20-v2.patch | 4.81 KB | Leksat |
#20 | 2395627-20.patch | 5.53 KB | Leksat |
#20 | 2395627-12-20-interdiff.txt | 1.8 KB | Leksat |
#12 | 2395627-12.patch | 5.34 KB | tstoeckler |
Comments
Comment #1
webflo CreditAttribution: webflo commentedComment #2
webflo CreditAttribution: webflo commentedComment #3
tstoecklerAwesome, thanks a lot!
I've hit this exact problem over in #2381147-4: Text and text with summary field default value config does not use the text_format schema type. See my 2. over in that comment.
Comment #5
alexpottDocs formatting - should be
Gets...
.Unneeded blank(ish) line.
Need to doc what the return value is.
An inline comment might be nice.
Comment #6
tstoecklerJust marked #2413481: Sequence translation as duplicate. That one simply uses an ltrim() instead of the array_filter(), which seems a little less (conceptual, not performance) overhead IMO. In any case, that means we should really fix this as multiple people (myself included) have been bitten by this.
Comment #7
tstoecklerComment #8
tstoecklerHere we go.
Fixed #5 added a beta evaluation and a suggested commit message, because I brought the ltrim() over from the referenced issue.
Comment #9
tstoecklerComment #10
tstoecklerWell, actually pasting the suggested commit message helps...
Comment #12
tstoecklerHehe, 8.0.x changed a bit in the meantime, so the test code itself "failed"...
Comment #13
Gábor HojtsyComment #14
Gábor HojtsyThis comment may not be accurate anymore. Probably not needed as its a method now.
of => if
In general it would be great to explain what are base and subkeys now that this is removed from its original surroundings.
Add comment block on method.
Comment #15
Gábor HojtsyNot being actively worked on.
Comment #16
Schnitzel CreditAttribution: Schnitzel commentedas @tstoeckler suggested here #2413481: Sequence translation there is a similar approach that would fix that as well, maybe we want to merge these two
Comment #17
Gábor Hojtsy@Schnitzel: wanna work on this? :)
Comment #18
tstoeckler@Schnitzel: I the latest patch already "merges" the two approaches in that I brought over the ltrim().
Comment #19
Schnitzel CreditAttribution: Schnitzel commented@Gabor
Wanna have it fixed yes :D
And yep, will check that I or one of my people will spend some time on it.
Comment #20
Leksat CreditAttribution: Leksat commented2395627-20.patch includes all fixes for #14
2395627-20-v2.patch is just another approach. It doesn't add the getElementKey() method, reasons:
- the $base_key variable is already described in getTranslationBuild() and setConfig() methods; there is no need to describe it in another one place
- when I see
$element_key = isset($base_key) ? "$base_key.$key" : $key;
I don't need any comments to understand what's happennigComment #21
Gábor HojtsyYeah v2 makes more sense, we don't need a method introduced to concatenate strings. Uploading again to make sure this one will be committed and not the other one.
Comment #22
alexpottCommitted 1ff477b and pushed to 8.0.x. Thanks!
Thanks for adding the beta evaluation to the issue summary.
Comment #24
Gábor HojtsyYay, thanks all!