Hi Mantainers,
I testet user read_only module in a client website and got a fatal cannot use string as an array error. The user wantet to change the contact settings in their account (this field was not user read_only protectet) but the array $form[$group][$key]['#attributes']['disabled'] = TRUE; could not be managed by drupal.
Quick and dirty solution is just to comment that line out (//). Problem you lose the hidden field, no gray in the backround any more. I will try to fix this, but any help is god because i´m to busy with more impotant stuff.
Dirk
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | contrib-5.user_readonly.error_.junyor.patch | 681 bytes | junyor |
Comments
Comment #1
jaydub commentedI can't totally confirm this fix and I haven't been able to recreate the bug but what I did notice when testing is that the error occurs when the value for $group in the
foreach ($form as $group => $data) {
part of the code that surrounds the offending line 208 had a value of of '#name' where name
was something I can't recall. I wrapped the test in line 191 with a regex test to see if $group
matches the #xxxx name. So
if (!array_key_exists($key,$field_list)) {
becomes
if ( (!array_key_exists($key,$field_list)) || (preg_match("/^#/",$group)) ) {
Comment #2
designwork commentedHi jaydub,
i will test it today, thanks
Dirk
Comment #3
jbrauer commentedI just ran into this today and made the change suggested by jdub in #1 and it worked well on our site.
Comment #4
junyor commentedThis happens if the form has top-level stuff like #parameters and/or #attributes. Attached is a patch that fixes the issue. The fix is similar to the one suggested by jaydub, but the check was moved earlier to save some processing.
Comment #5
deekayen commentedcommitted
Comment #6
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.