Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

PHP7.2 issues

PHP7.2 issues

I'm in the process of moving my site to a new server that runs on PHP7.2
So far it seems to be running well, apart from MetaMod Pro.

I keep getting the following error;
Warning: count(): Parameter must be an array or an object that implements Countable in xxxxx/xxxxx/xxxxxx/public_html/plugins/system/metamodpro/metamodpro.php on line 378

I did install a new version of MetaMod Pro already. (MetaModPro3-30-for-J1-7-to-3-8)
I'm running Joomla 3.8.7

Any idea how I can get rid of the error?

Many thanks in advance!
Mark

mediasaurus
Beginner Modder
ranks
useravatar
Offline
5 Posts
Administrator has disabled public posting

Re: PHP7.2 issues

Hi Mark,

so far I have been unable to replicate this. I have PHP7.2.1 on a test server and did some basic tests, pulling in a module, and using the $changes mechanism.

Could you post here (or email me if you prefer) with the PHP code you are using, and a description of any other settings, so I can try to replicate it?

Having said that, it should be a fairly simple change to the affected line to prevent the error from occurring, but I would prefer to understand what's really going on behind the scenes.

Thanks,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Re: PHP7.2 issues

Hi Stephen,

Thanks for testing and your help in resolving this issue!!
I really appreciate you're willingness to find out why issues like these occur, even though they're probably caused by the users lack of skills...

Currently I'm only using MetaMod to display a random module on my homepage.

The PHP code that I'm using is:
$r = mt_rand(1, 4);
if ($r == 1) return 226;
if ($r == 2) return 254;
if ($r == 3) return 255;
if ($r == 4) return 256;

I haven't customised any settings when creating the MetaMod module that displays 1 of above 4 modules randomly.
(I have to add that MetaMod does function like it always did on PHP5.3.6 or 5.6, I'm just getting the error now when running on PHP7.2)

Hopefully above will provide you the needed details.
(I'm sorry, I'm pretty much a noob when it comes to MetaMod or PHP, but I'm hoping that one day I've learned enough so I can troubleshoot silly issues like these myself.)

Again, many thanks for your help!!!

Best regards,
Mark

mediasaurus
Beginner Modder
ranks
useravatar
Offline
5 Posts
Administrator has disabled public posting

Re: PHP7.2 issues

Hi,
Your PHP recipe is very standard so it's very hard to know why that particular warning (not error!) is being raised. I'll try some more to replicate it, and will modify MetaMod to do some more error checking.

Out of interest, can you tell me what exact version of PHP you are using? e.g. 7.2.1?

Thanks
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Re: PHP7.2 issues

Hi Stephen,

Many thanks!

The webserver is running PHP/7.2.5
Hope this helps?
(If it would be handy to have a link to the site, please let me know and I'll supply by email.)

Many thanks for your help!!
Mark

mediasaurus
Beginner Modder
ranks
useravatar
Offline
5 Posts
Administrator has disabled public posting

Re: PHP7.2 issues

ok, thanks for the version number. I've isolated the problem which is due to PHP 7.2 changes: http://php.net/manual/en/migration72.incompatible.php

I'll send you a new version of MetaModPro shortly - could you test it out and let me know if it fixes the problem for you?

Thanks
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Re: PHP7.2 issues

The issue is now solved - see MetaMod Pro v3.31 now available for download for registered customers.

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Re: PHP7.2 issues

Just to help others, I had the same problem with error message "Warning: count(): Parameter must be an array or an object that implements Countable in.." and I have v.3.31 so it couldn't be the cause.

My problem was a module with sql and I had a ampersand before JFactory.
$user =& JFactory::getUser();
I removed the & before JFactory and error was gone.
I just thought I'd add this since it was so simple but yet so hard to find.

bonnie_lass
Beginner Modder
ranks
useravatar
Offline
1 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5933
Total Posts Today:
2
User Info:
 
Total Users:
4371
Newest User:
kajha63871
Members Online:
0
Guests Online:
218

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked