Page MenuHomePhabricator

Array values for attributes in Html::element cause PHP notice.
Closed, ResolvedPublic

Description

Found by SPQRobin.

Notice: Array to string conversion in /home/robin/public_html/mw/dev/includes/Html.php on line 328":
the classes attribute should be passed as a string instead of an array. Introduced in c13632.

Seems to be because Html::dropDefaults() calls strval() on all attribute values, but Html allows arrays as attribute values, which causes a problem. Change to soon be in gerrit.


Version: unspecified
Severity: normal
URL: https://gerrit.wikimedia.org/r/22278

Details

Reference
bz39875

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:55 AM
bzimport set Reference to bz39875.
bzimport added a subscriber: Unknown Object (MLST).

Thanks. I had the impression arrays were not allowed, but they are so your change is a better fix for the problem.

Yeah. Originally I saw the patch and thought to myself "Hmm, why not just accept arrays in Html?", and then I looked and saw it was already accepted. :P

On a side note, I left a comment on https://gerrit.wikimedia.org/r/22005 concerning this, because Hashar is making a whole new test case for the dropDefaults() function, and this would be a perfect addition.

  • Bug 39650 has been marked as a duplicate of this bug. ***