? Pending

User tests: Successful: Unsuccessful:

avatar weeblr
weeblr
26 Apr 2017

Per #15548, multiple Cannot use a scalar value as an array warning are showing on many sites after update to Joomla 3.7

Pull Request for Issue # 15448.

Summary of Changes

Removed test on $attribs being an array. Issue analysis by George Wilson is here: #15548 (comment)

Testing Instructions

On site showing those warnings, applying the patch should stop them, and restored functionalities that may be broken (Some Payplans features stop working) because the corresponding javascript file is actually not inserted in the page.

Expected result

Actual result

Documentation Changes Required

avatar weeblr weeblr - open - 26 Apr 2017
avatar weeblr weeblr - change - 26 Apr 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 26 Apr 2017
Category Libraries
avatar wilsonge wilsonge - change - 27 Apr 2017
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-04-27 12:52:47
Closed_By wilsonge
Labels Added: ?
avatar wilsonge wilsonge - close - 27 Apr 2017
avatar wilsonge wilsonge - merge - 27 Apr 2017
avatar wilsonge
wilsonge - comment - 27 Apr 2017

Thanks for doing this whilst I was out!

avatar Quy
Quy - comment - 29 Apr 2017

@weeblr @wilsonge These 2 functions stylesheet() and script() are similar yet the following lines are different. Should they be the same since there is a pending pr #15641 to fix a related issue?

https://github.com/weeblr/joomla-cms/blob/ded3c883f6cd753649da86686b28ac02cfdc47b3/libraries/cms/html/html.php#L604

https://github.com/weeblr/joomla-cms/blob/ded3c883f6cd753649da86686b28ac02cfdc47b3/libraries/cms/html/html.php#L676

avatar wilsonge
wilsonge - comment - 29 Apr 2017

The only difference is the variable name?

avatar Quy
Quy - comment - 29 Apr 2017

Correct. Should line 604 be if (!is_array($options))?

avatar Quy
Quy - comment - 29 Apr 2017

If yes, then #15641 can be closed.

avatar weeblr
weeblr - comment - 29 Apr 2017

@wilsonge @Quy They should NOT be the same I think. The previous, deprecated methods signatures are different.
stylesheet(file, attribs, relative, pathOnly, detectBrowser, detectDebug)
vs
script(file, framework, relative, pathOnly, detectBrowser, detectDebug)

For stylesheet, we test only the second parameter ($attribs) because the first ($options) was also an array in both old and new signature.

As you can see in the next lines, the code to handle $attribs and $options is not the same.

avatar Quy
Quy - comment - 29 Apr 2017

@weeblr @wilsonge In stylesheet, attribs would be assigned to options from the old to the new so you would have to test for $options?

avatar weeblr
weeblr - comment - 29 Apr 2017

No, it's about how the method is called.
stylesheet() can be called either with:

  • old syntax: stylesheet(string, array, bool,...)
  • new syntax: stylesheet(string, array, array)

So the way to detect whether the call is with the new or old syntax is by looking at the 3rd parameter. If an array, it's the new syntax. If not an array, then it 's the old syntax.
The variable names are not what matters, it's more about the ordering.

avatar tracylee3124
tracylee3124 - comment - 1 May 2017

screen shot 2017-05-01 at 16 46 42
We just updated to Joomla! 3.7.0 and I started getting this warning message on the panel that allows you to upload documents and add a link to the page. I was having trouble uploading files using that.

I am not sure what I should edit to fix this issue.

Can someone give some advice?

Thanks,
Tracy


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

avatar weeblr
weeblr - comment - 1 May 2017

@tracylee3124 Maybe best is to wait until a new Joomla release is available? I suspect there might be one coming, though @wilsonge or @rdeutz would know better.

If you don't want to wait, you should apply the modification displayed on the "Files changed" tab of this page. The link to there is: https://github.com/joomla/joomla-cms/pull/15600/files

Be sure to always be able to restore any file you modify this way, in case something goes wrong.

Add a Comment

Login with GitHub to post a comment