- 🇳🇱Netherlands Eric_A
Was this fixed in 🐛 Config schema errors Fixed ? Or is it partially fixed?
The merge request here is all about arrays, while the other issue further stringified things. - 🇳🇱Netherlands Eric_A
- 🇺🇸United States audioroger Bristol, VT
Uploading the patch generated from https://git.drupalcode.org/project/readonlymode/-/merge_requests/4/diffs... based on comment 19.
Don't be mad y'all, I know there are plenty of conversations around uploaded patches vs. using MR generated patches locally. For me, I'm contributing this patch to another project that doesn't have local patches, so I want a permanent link. So far as I can tell this is not yet supported in GitLab.
Patch in #23 did not work for me on D10.
In admin/config/development/maintenance, I got:
TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in implode() (line 102 of modules/contrib/readonlymode/readonlymode.module).
I could get a no error or warning install using
- Using
https://www.drupal.org/files/issues/2023-04-17/argument-passed-as-string... →
fixed
TypeError: Argument 2 passed to _readonlymode_form_list_check() must be of the type string, array given
. Credit to OPTASY 🐛 Argument 2 passed to _readonlymode_form_list_check() must be of the type array, string given Active - Using https://git.drupalcode.org/project/readonlymode/-/commit/2ef5cf6e49dbcca... fixed
Warning: Undefined array key "show_view_elements"
. Credit to Ben Teegarden - There was also a "
Warning: Undefined array key "actions"
" in some administrative pages that I fixed appending the 'actions' key just like in item 2.
- Using
https://www.drupal.org/files/issues/2023-04-17/argument-passed-as-string... →
fixed
- 🇫🇷France iheb.attia
Same patch as #24 but remove only 'show_view_elements' element from form.
- 🇬🇧United Kingdom altcom_neil
We are using patch #23 successfully in production sites.
@Imlima If you were getting the
TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in implode()
andTypeError: Argument 2 passed to _readonlymode_form_list_check() must be of the type string, array given
errors after applying patch #23 then you hadn't rundrush updatedb
to runreadonlymode_update_8002()
which converts the 'forms.additional.edit' and 'forms.additional.view' config items into arrays? Or had they errored and failed somehow?There are now two ways of fixing the issue in patches, up to and including patch #23 and in the merge request it was all about making the two config vars arrays as the code was expecting, patch #25 and #27 are simpler by just changing what the code to expecting the strings as they are in the current config.
Personally I favour the first solution to make the config arrays as that is what the code uses in
_readonlymode_form_list_check()
. If the config is saved as an array then it is only converted from string to array and back again once in the admin form. When it is being used during normal site operation the config is an array.
By keeping it as a string in the config every time that_readonlymode_form_list_check()
is called the string has to be split into an array at that point. Not a massive overhead but it seems that it is better to store the config how it is intended to be used, not just as a consequence of how it is edited in the admin form? - 🇺🇸United States petermallett
As mentioned in comment #21 above ( #3115119-21: Fatal error due to saved additional form IDs being strings and not arrays → ),
it seems this patch may no longer be needed as the 1.3 release fixed the config schema by correctly specifying these values as strings rather than converting the storage to arrays: 🐛 Config schema errors Fixed .It looks like upgrading to 1.3 , re-configuring the module, and re-exporting the config would fix things.