- Issue created by @bircher
- ๐ฎ๐ณIndia ayush.khare
ayush.khare โ made their first commit to this issueโs fork.
- ๐จ๐ญSwitzerland bircher ๐จ๐ฟ
So this is a bug in Config Filter, actually.
- Open on Drupal.org โCore: 9.5.x + Environment: PHP 7.4 & MySQL 8last update
about 1 year ago Not currently mergeable. - @ayushkhare opened merge request.
- last update
about 1 year ago 13 pass, 10 fail - @ayushkhare opened merge request.
-
bircher โ
committed e24bbab8 on 8.x-1.x
Issue #3396813 by bircher: Use FALSE when filters return the empty array...
-
bircher โ
committed e24bbab8 on 8.x-1.x
-
bircher โ
committed dbd761b1 on 8.x-2.x
Issue #3396813 by bircher: Use FALSE when filters return the empty array...
-
bircher โ
committed dbd761b1 on 8.x-2.x
- Status changed to Fixed
about 1 year ago 8:20am 26 October 2023 - Status changed to Active
about 1 year ago 8:22am 26 October 2023 - Status changed to Fixed
about 1 year ago 8:25am 26 October 2023 - ๐ณ๐ดNorway jonsimonsen
For the record, I tested this fix on my local setup. The previous behavior of exporting empty files that should not get exported into the default sync directory (because they were in a dev split) did indeed get fixed. Thank you, https://www.drupal.org/u/bircher โ
- ๐จ๐ญSwitzerland bircher ๐จ๐ฟ
updating the issue summary for posterity.
Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
11 months ago 6:35pm 6 December 2023 - ๐ฉ๐ชGermany donquixote
It works, thank you!
I was wondering, will this not also nuke legitimate empty-array configs.
I came to the conclusion this cannot happen because all the configs contain at least the ['_core']['default_config_hash'].
Also in general this is not how config is used.
So all good. - ๐ฉ๐ชGermany donquixote
Actually not so sure anymore.
If I delete all files in config/sync/* and run drush cex again, then at that point the $data['uuid'] and $data['_core']['default_config_hash'] are both missing when the data goes to ->filterWrite().In theory, there could be a module where an empty array config has a distinct meaning that is different from a NULL config.
- ๐ฉ๐ชGermany donquixote
I wonder what would happen if, in the loop, when $data is FALSE or NULL, we call ->filterDelete() instead of ->filterWrite()?
- ๐จ๐ญSwitzerland bircher ๐จ๐ฟ
an empty array will remain an empty array.
The if clause checks for is_array which the empty one passes so it will not be set to false.The only thing you can not do any more is know if a previous filter had set it to false or an empty array. But I consider that an acceptable tradeoff as it is such an edge case.
Also I think it is important to call the filter methods corresponding to the storage method and not mix them that would mean a filter behaves differently depending on other filters that come before.
- ๐ฉ๐ชGermany donquixote
The only thing you can not do any more is know if a previous filter had set it to false or an empty array. But I consider that an acceptable tradeoff as it is such an edge case.
You are right!
The$data = FALSE
only happens if it already was not an array before.
So it's all good.
Sorry for the noise :)