?
Referenced as Pull Request for: # 15641
avatar sanio
sanio
25 Apr 2017

Steps to reproduce the issue

No Idea

Expected result

no any Warnings

Actual result

Warning: Cannot use a scalar value as an array in /var/www/web3/web/libraries/cms/html/html.php on line 693
Warning messages in lines 693 694 695 696 and 697

System information (as much as possible)

Ubuntu 6.14 php 7.0 apache2 with php-fpm

Additional comments

My very first report, am not sure that my compnent has no errors in my code

I think warning generated when i use this code
JHtml::script(JUri::base() . 'components/com_rentflat/assets/test.js', true); in my default.php view

warning

avatar sanio sanio - open - 25 Apr 2017
avatar joomla-cms-bot joomla-cms-bot - change - 25 Apr 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 25 Apr 2017
avatar wilsonge
wilsonge - comment - 25 Apr 2017

OK I can confirm this on code review. Seems like the code we added in as a b/c layer expects that you have 3 parameters (the first always being the resource, the second the mootools inclusion, 3rd the relative to media directory). Unfortunately as we are only injecting a single parameter here the b/c compatible code https://github.com/joomla/joomla-cms/blob/3.7.0/libraries/cms/html/html.php#L673-L676 isn't triggered and therefore we think we have an options array (which isn't - it's just a boolean) and everything falls apart

avatar franz-wohlkoenig franz-wohlkoenig - change - 26 Apr 2017
Status New Confirmed
avatar franz-wohlkoenig franz-wohlkoenig - change - 26 Apr 2017
Category com_plugins
avatar sanio
sanio - comment - 26 Apr 2017

dear wilsonge ,
could you pls tell how to suppress this warning

avatar zero-24
zero-24 - comment - 26 Apr 2017

-JHtml::script(JUri::base() . 'components/com_rentflat/assets/test.js', true);

+$options = array('framework' => true);
+JHtml::script(JUri::base() . 'components/com_rentflat/assets/test.js', $options);

This should do the trick for now.

avatar zero-24
zero-24 - comment - 26 Apr 2017

@wilsonge what about a empty check too? So we do not pass that if we have empty arrays?

avatar zero-24
zero-24 - comment - 26 Apr 2017

Maybe also

if (!is_array($options) || !is_array($attribs))

Should do the trick too as only one can also be passed.

avatar wilsonge
wilsonge - comment - 26 Apr 2017

I mean is if (!is_array($options) enough?

avatar brianteeman brianteeman - edited - 26 Apr 2017
avatar weeblr
weeblr - comment - 26 Apr 2017

@wilsonge Dropping the test on $attribs fixed the problem for me indeed, ie
// B/C before 3.7.0 if (!is_array($options) /*&& !is_array($attribs) */) {

avatar wilsonge
wilsonge - comment - 26 Apr 2017

Can you do a PR @weeblr - currently not at a computer

avatar weeblr
weeblr - comment - 26 Apr 2017

Hi George, not really, I am struggling to fix all the issue on sites being updated. There is another B/C break associated with the changes in internal representation of the scripts. You have a B/C layer when adding a script, but because the internal representation has changed, when using $document->getHeadData(), the data returned also changed format, and this is breaking quite some code we have on the sites for enhanced caching.

Will try.

avatar weeblr
weeblr - comment - 26 Apr 2017

Here it is #15600

avatar sanio
sanio - comment - 26 Apr 2017

Thanks a lot

avatar sanio sanio - change - 26 Apr 2017
Title
Warning after upgraiding from 3.6 to 3.7
Warning after upgrading from 3.6 to 3.7
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2017-04-26 19:15:54
Closed_By sanio
avatar sanio sanio - close - 26 Apr 2017
avatar jeeperinaz
jeeperinaz - comment - 24 Jul 2017

#15600 was already applied and I still get these errors. Any Eta? I'm on 3.7.3..
socialhour.club

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 24 Jul 2017

@jeeperinaz can you please open a new Issue givin exact Informations as this is a closed one?

Add a Comment

Login with GitHub to post a comment