[j1.6] Error with single article view

Professional Jomal template designed to be easily adaptable to all kinds of business
GK User
Wed Mar 02, 2011 8:21 pm
Hi, i get this error when viewing a single article

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /www/templates/gk_corporate2/lib/gk.framework.php on line 626


And the menu i added to "footer_nav" gets displayed in 2 positions.

http://berlinestate.co/index.php/impressum
User avatar
Junior Boarder

GK User
Wed Mar 02, 2011 9:08 pm
Please turn off the display_errors in your PHP configuration which is recommended for Joomla, this is only Warning not Error message.
User avatar
Platinum Boarder

GK User
Thu Mar 03, 2011 9:53 pm
That workd.
User avatar
Junior Boarder

GK User
Fri Mar 25, 2011 11:02 pm
Sorry to reply to this thread, but I got this one as well, and switching error reporting off isn't a fix, it's just an easy way to hide the error.

I guess you are using the Social API? And have chosen not to exclude any categories? At least that's when I got the same error.

Did some debugging and if you check the $excluded_articles array it contains data even if the field is empty, just an empty string inside an array, but it's there so it is not NULL or a none existing array which the in_array functions that throws the error is looking for.

What I did to solve this was to go into the gk.framework.php file and find the getParam for $excluded_categories:
Code: Select all
$excluded_articles = explode(',', $this->getParam('excluded_arts', ''));
$excluded_categories = $this->getParam('excluded_cats', '');

and changed it into:
Code: Select all
$excluded_articles = explode(',', $this->getParam('excluded_arts', ''));
$excluded_categories = $this->getParam('excluded_cats', array(''));


At least this made it work without having suppressing the error by switching error reporting off. That way I can have error reporting active while I continue to hunt for other errors without seeing this error anymore. ;)

Hope this change or something like it will be done in the gk.framework.php file in the future so that we don't have to get this error again.. ;)


PS:
Tried using explode for categories as it's done for articles, but that didn't help, just made the social API buttons show up everywhere disregarding the selected categories when selecting any.
User avatar
Fresh Boarder

GK User
Sat Mar 26, 2011 12:03 am
@perry

Thank you for your suggestion.
Much appreciated. ;)

I will address this to our Programmer.

Cheers
User avatar
Platinum Boarder

GK User
Sat Mar 26, 2011 12:15 am
I spoke to our programmer and it seams that we have found and test few versions of the solutions for this issue and every solution works on the different PHP version, but not all. So the best solution is disabling Warnings in php.ini, like Joomla recommend.

Anyway, thank you again for your contribution.
Much appreciated ;)
User avatar
Platinum Boarder

GK User
Sat Mar 26, 2011 12:54 am
For a production site I agree on switching off warnings, but when debugging and developing a new site warnings happens to come in handy if(when) you have done something wrong in a template file or a customization on a component or something like that.. ;) Errors do occur.

For this error on the current site I'm working with I removed the in_array warning by doing it this way, so for this site I guess the error will be fixed until the server is updated with a newer PHP version since it's using 5.2.6 at the moment. And for others searching the same warning message with the same PHP version can find this post.

By the way, this was in the Penguin Mail template, not Corporate 2. I just searched and found this by the in_array warning and gk.framework.php file, forgot to mention that in my first post there.

And thanks for all your templates and stuff.. :) really nice work, and easy to sell to customers..
User avatar
Fresh Boarder


cron