- Posts: 7
COMMUNITY FORUM
Parameter must be an array
- Michael Mc
- Topic Author
- Offline
- New Member
Less
More
6 years 9 months ago #166744
by Michael Mc
Parameter must be an array was created by Michael Mc
Hello there,
So I have a fresh install Joomla Version 3.8.5
Just installed K2 and started to set stuff up.
Whenever Joomla brings up a K2 Article Page I receive the 2 error messages: The first one (1) is on top of the screen before the title, the second message (2) before Read xx times.
1) Warning: count(): Parameter must be an array or an object that implements Countable in E:\xampp\htdocs\Joomla\components\com_k2\models\item.php on line 877
2) Warning: count(): Parameter must be an array or an object that implements Countable in E:\xampp\htdocs\Joomla\components\com_k2\templates\default\item.php on line 248
I receive no other error message anywhere on the site. Everything else is normal. I went through the count options on the category screen and turn off anything that was counting related. Still no go.
PHP Version 7.2.1
Web Server Apache/2.4.29 (Win32) OpenSSL/1.1.0g PHP/7.2.1
WebServer to PHP Interface apache2handler
Joomla! Version Joomla! 3.8.5 Stable [ Amani ] 6-February-2018 15:00 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
Thanks in advance!
So I have a fresh install Joomla Version 3.8.5
Just installed K2 and started to set stuff up.
Whenever Joomla brings up a K2 Article Page I receive the 2 error messages: The first one (1) is on top of the screen before the title, the second message (2) before Read xx times.
1) Warning: count(): Parameter must be an array or an object that implements Countable in E:\xampp\htdocs\Joomla\components\com_k2\models\item.php on line 877
2) Warning: count(): Parameter must be an array or an object that implements Countable in E:\xampp\htdocs\Joomla\components\com_k2\templates\default\item.php on line 248
I receive no other error message anywhere on the site. Everything else is normal. I went through the count options on the category screen and turn off anything that was counting related. Still no go.
PHP Version 7.2.1
Web Server Apache/2.4.29 (Win32) OpenSSL/1.1.0g PHP/7.2.1
WebServer to PHP Interface apache2handler
Joomla! Version Joomla! 3.8.5 Stable [ Amani ] 6-February-2018 15:00 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
Thanks in advance!
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
6 years 9 months ago #166780
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Parameter must be an array
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Kannan Naidu Venugopal
- Offline
- Platinum Member
- Aham Brahmasmi
6 years 7 months ago - 6 years 7 months ago #167475
by Kannan Naidu Venugopal
K2 Rocks \m/
Replied by Kannan Naidu Venugopal on topic Parameter must be an array
It's the same with the DEV version.
This happens in PHP 7.2.X and when an item does not have any extra fields assigned. Removing the count helps the error go away but will it open floodgates in other version of PHP? :P
components/com_k2/models/item.php
line 760 // Extra fields plugins
changed to
This happens in PHP 7.2.X and when an item does not have any extra fields assigned. Removing the count helps the error go away but will it open floodgates in other version of PHP? :P
components/com_k2/models/item.php
line 760 // Extra fields plugins
if (count($item->extra_fields) && is_array($item->extra_fields)) {
changed to
if (is_array($item->extra_fields)) {
K2 Rocks \m/
Last edit: 6 years 7 months ago by Kannan Naidu Venugopal. Reason: referenced the file name
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
6 years 7 months ago #167492
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Parameter must be an array
Hello there Kannan :)
What does var_dump($item->extra_fields) produce in your items?
I mean the ones with no extra fields.
What does var_dump($item->extra_fields) produce in your items?
I mean the ones with no extra fields.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Kannan Naidu Venugopal
- Offline
- Platinum Member
- Aham Brahmasmi
6 years 7 months ago #167508
by Kannan Naidu Venugopal
K2 Rocks \m/
Replied by Kannan Naidu Venugopal on topic Parameter must be an array
Χαίρετε Krikor :)
It returns NULL.
This warning message shows in other areas too, like the frontend edit form
Before selecting category
Warning: count(): Parameter must be an array or an object that implements Countable in E:\mytemplate....\html\com_k2\default\itemform.php on line 123
After selecting category
Warning: count(): Parameter must be an array or an object that implements Countable in E:\.....\administrator\components\com_k2\models\extrafield.php on line 211
This has something to do with PHP 7.2.x - This warning does not show in PHP 7.1.9
See Here
It returns NULL.
This warning message shows in other areas too, like the frontend edit form
Before selecting category
Warning: count(): Parameter must be an array or an object that implements Countable in E:\mytemplate....\html\com_k2\default\itemform.php on line 123
After selecting category
Warning: count(): Parameter must be an array or an object that implements Countable in E:\.....\administrator\components\com_k2\models\extrafield.php on line 211
This has something to do with PHP 7.2.x - This warning does not show in PHP 7.1.9
See Here
K2 Rocks \m/
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
6 years 7 months ago #167520
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Parameter must be an array
I' 'll look into it but another check but this warning will not affect your site's functionality.
Removing that check might cause issues.This might be a more suitable solution
Removing that check might cause issues.
if (is_array($item->extra_fields)) {
if(count($item->extra_fields)) {
...
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- borja
- Offline
- New Member
Less
More
- Posts: 14
6 years 2 months ago #169115
by borja
Replied by borja on topic Parameter must be an array
I´ve got the error and i solved it. i changed to php 7.2 this week but the error appeared this week. why?
I see that the last version of k2 is from auust 2017. do you know when there would be a new version? Is there any problem? Which is the php versoin for joomla?
I see that the last version of k2 is from auust 2017. do you know when there would be a new version? Is there any problem? Which is the php versoin for joomla?
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
6 years 2 months ago #169117
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic Parameter must be an array
K2 v2.9.0 is coming on Monday Sept. 17th. Please grab the dev version from github.com/getk2/k2/archive/master.zip (marked as 2.8.1 so you can upgrade to 2.9.0 when it's out) and check again. If you still see the issue, report back please to have a look as we may have fixed this already.
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- borja
- Offline
- New Member
Less
More
- Posts: 14
6 years 2 months ago #169193
by borja
Replied by borja on topic Parameter must be an array
Is the new version ready? I´ve been looking getk2.com and it says that the current version is from 17th August 2017.
which is the suitable version for the current version of k2? php 7.2 or previous?
which is the suitable version for the current version of k2? php 7.2 or previous?
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
6 years 2 months ago #169207
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic Parameter must be an array
2.9.0 will be released within the week. Prefer the dev version for now from: github.com/getk2/k2/archive/master.zip
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.