? Success

User tests: Successful: Unsuccessful:

avatar 810
810
22 Jan 2016

Issue #8923

Error: Argument 1 passed to Joomla\Utilities\ArrayHelper::toString() must be of the type array, string given, called in \libraries\joomla\document\renderer\html\head.php on line 119 and defined in libraries/vendor/joomla/utilities/src/ArrayHelper.php on line 104

Fix

add an is_array check

avatar 810 810 - open - 22 Jan 2016
avatar 810 810 - change - 22 Jan 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 22 Jan 2016
Labels Added: ?
avatar 810
810 - comment - 22 Jan 2016

Or @photodude can help with fixing the real bug.

avatar mbabker
mbabker - comment - 23 Jan 2016

I'm going to be completely honest. While the core needs to check if (is_array($linkAttr['attribs'])) since the API doesn't validate object types in parameters (typehinting where possible) extensions too need to implement fixes (that are backward compatible) so that if the CMS were to start typehinting values, bugs like this couldn't happen. If you're calling JHtml::stylesheet() or JDocument::addStyleSheet() with the parameter for the attribs array as a boolean false (I'm guilty of this and I know there are places in core doing it), your code is wrong according to the method documentation and should be corrected.

avatar 810
810 - comment - 23 Jan 2016

@mbabker thnx i did found the issue on our part, thnx for the hint. So i can close this issue?

avatar 810 810 - change - 23 Jan 2016
Title
Revert Arrayhelper on Head Document
Add is_array check on head document
avatar 810
810 - comment - 23 Jan 2016

ok, added the suggestion. Now it can be reviewed and merged

avatar photodude
photodude - comment - 23 Jan 2016

@mbabker Is it possible that $linkAtrr['attribs'] or $strAttr['attribs'] could not be an array?

avatar mbabker
mbabker - comment - 23 Jan 2016

Right now, yes, because the CMS does not enforce the documented object type (in any place where that can be set, it is documented to be an array, but there are places where a boolean false is given for the parameter). So until 4.0 when the method signatures can change to enforce it being an array (typehint the param), when using those params you'll have to check if they are arrays.

avatar photodude
photodude - comment - 23 Jan 2016

OK, so in 3.x the possibilities for $linkAtrr['attribs'] or $strAttr['attribs'] are boolean false or array. It makes sense that if (is_array(______)) would be sufficent without an else clause to catch other possibilities. (typically I prefer explicit commenting for such cases where if does not include an else. Never know when the next person reading the code will assume there is a mistake to fix when really it was just a design choice).

avatar photodude
photodude - comment - 23 Jan 2016

@kunena Do you have testing instructions for this patch?

avatar 810
810 - comment - 23 Jan 2016

@photodude install kunena, enable the forum menu item on mainmenu.

Frontend: click on it and you will see the error.

Fix on Kunena:
https://github.com/Kunena/Kunena-Forum/pull/3642/files

avatar 810
810 - comment - 28 Jan 2016

@wilsonge could you check this one

avatar Gitjk
Gitjk - comment - 29 Jan 2016

Got the "Catchable fatal error..." shown in the attached screenshot with today's staging snapshot. Applied this patch and the error doesn't show up anymore.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8968.

avatar Gitjk
Gitjk - comment - 29 Jan 2016

screen shot 2016-01-29 at 12 41 04


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8968.

avatar 810 810 - test_item - 3 Feb 2016 - Tested successfully
avatar 810
810 - comment - 3 Feb 2016

I have tested this item :white_check_mark: successfully on 6118048


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8968.

avatar 810
810 - comment - 3 Feb 2016

@Gitjk could you set the test to successfully on issues


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8968.

avatar anibalsanchez anibalsanchez - test_item - 5 Feb 2016 - Tested successfully
avatar anibalsanchez
anibalsanchez - comment - 5 Feb 2016

I have tested this item :white_check_mark: successfully on 6118048

Test OK


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8968.

avatar wilsonge wilsonge - change - 5 Feb 2016
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2016-02-05 15:15:35
Closed_By wilsonge
avatar wilsonge wilsonge - close - 5 Feb 2016
avatar wilsonge wilsonge - reference | fc6dab4 - 5 Feb 16
avatar wilsonge wilsonge - merge - 5 Feb 2016
avatar wilsonge wilsonge - close - 5 Feb 2016
avatar wilsonge wilsonge - change - 5 Feb 2016
Milestone Added:

Add a Comment

Login with GitHub to post a comment