Closed (fixed)
Project:
Material Admin
Version:
2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Jul 2018 at 15:38 UTC
Updated:
8 Feb 2021 at 21:43 UTC
Jump to comment: Most recent, Most recent file
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