Notice: Array to string conversion in material_admin_preprocess_input() (line 81 of themes/contrib/material_admin/inc/preprocess.inc).
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | material_admin-v2-array_to_string_notice-2989199-15.patch | 959 bytes | ocastle |
| #9 | material_admin-array_to_string_notice-2989199-9.patch | 959 bytes | mvonfrie |
| #7 | implode-argument-must-be-array-2989199-7.patch | 836 bytes | xpersonas |
| #5 | material_admin-array_to_string_notice-2989199-5-D8.patch | 831 bytes | reszli |
| #3 | warning-msg.txt | 7.74 KB | sergei_semipiadniy |
Comments
Comment #3
sergei_semipiadniy commentedHi,
@xpersonas, I installed fresh drupal 8.5.6 and faced with a warning, probably, that has been appeared after this fix.
File with dump of a warning is enclosed, as well as a fresh patch.
Regards
Comment #4
jwjoshuawalker commentedSame error here. The patch fixes it, but I feel like we could do this more cleanly.
Comment #5
reszlislightly modified patch to remove all errors
I agree that this is probably not the best way, but who's in a hurry...
Comment #6
mariagwyn commentedI can confirm that the patch silences the error.
Comment #7
xpersonas commentedI'm debating if this should be a new issue, but it involves the exact same piece of code so i'm putting it here. I'm getting a notice about the implode function in this check....
Warning: implode(): Argument must be an arrayI have a new patch that breaks the argument into two lines, checking that it's an array first. If you guys have a better way to handle, let me know. But this is working for me at the moment.
Comment #8
mvonfrie commentedI have the exact same issue with Drupal 8.6.10 now and figured out that
$variables['attributes']['placeholder']can be a string instead of an array, either empty or with a placeholder value (e. g. for a Drupal Commerce price field the default placeholder is 9,99 and"9.99" == $variables['attributes']['placeholder'].According to https://secure.php.net/manual/en/function.implode.php the implode function has two signatures:
If
$variables['attributes']['placeholder']is expected to be an array as in all previous patches but actually is a string, none of the implode function matches because the string is optional and the array is required.Comment #9
mvonfrie commentedHere is a new patch with different checks whether
$variables['attributes']['placeholder']is a string or an array.Comment #10
bleen commentedJust tested with alpha7 and this worked perfect ... based on the comments in #8 this fix makes sense.
Comment #11
tancAnother confirmation that the patch fixes the issue.
Comment #12
thejimbirch commentedThat patch in #9 applies to alpha7 and fixes the warnings.
To Verify:
Visit
/admin/reports/updatesVisit
/admin/reports/dblogand verify the PHP Warning did not post.Comment #13
e0ipsoThanks for the patch everyone! This should be merged now.
Comment #15
ocastle commentedThis change has been lost in 2.x
Attaching Patch.
Comment #16
thejimbirch commentedYou may want to open a new issue @ocastle. Only maintainers can reopen closed issues so they may not see this.
Comment #17
ocastle commentedThanks @thejimbirch - Done
https://www.drupal.org/project/material_admin/issues/3197375