djtiger76 Posted April 5, 2020 Report Share Posted April 5, 2020 Another day, another error 😀  Wondering if anyone could assist. I was looking to approve a PIREP in the admin panel and got 2 errors:  -Warning: count(): Parameter must be an array or an object that implements Countable in /home/tstamer/public_html/crew/admin/modules/PIREPAdmin/PIREPAdmin.php on line 120 -Warning: Invalid argument supplied for foreach() in /home/tstamer/public_html/crew/admin/modules/PIREPAdmin/PIREPAdmin.php on line 122 0 of 0 were approved (0 has errors)  Ive looked around the internet for solutions to fix and while there are several suggestion on how to fix, i swear its like reading a different language! I can't wrap my head around it. phpVMS 5.5.2 - PHP 5.6 Here is that section on the PIREPAdmin.php from admin/modules/:  public function approveall() {     $this->checkPermission(MODERATE_PIREPS);          echo '<h3>Approve All</h3>';     $allpireps = PIREPData::findPIREPS(array('p.accepted' => PIREP_PENDING));          $total = count($allpireps);     $count = 0;     foreach ($allpireps as $pirep_details) {              if ($pirep_details->aircraft == '') {         continue;       }       # Update pilot stats       SchedulesData::IncrementFlownCount($pirep_details->code, $pirep_details->flightnum);       PIREPData::ChangePIREPStatus($pirep_details->pirepid, PIREP_ACCEPTED); // 1 is accepted       #PilotData::UpdatePilotStats($pirep_details->pilotid);       #RanksData::CalculateUpdatePilotRank($pirep_details->pilotid);       RanksData::CalculatePilotRanks();       #PilotData::GenerateSignature($pirep_details->pilotid);       #StatsData::UpdateTotalHours();       CodonEvent::Dispatch('pirep_accepted', 'PIREPAdmin', $pirep_details);       $count++;     }     $skipped = $total - $count;     echo "$count of $total were approved ({$skipped} has errors)";   }  Thanks Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted April 5, 2020 Administrators Report Share Posted April 5, 2020 The first thing I would do is to verify that the directory phpVMS is in is using PHP 5.6 and not some version of PHP7. You shouldn't get that error in PHP 5.6 .  Create a phpinfo.php file to check the PHP info of the phpVMS directory. https://mediatemple.net/community/products/dv/204643880/how-can-i-create-a-phpinfo.php-page Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted April 5, 2020 Moderators Report Share Posted April 5, 2020 phpVMS has several count functions. As @ProAvia said, you are probably using PHP 7.2. I would open my core/local.config.php and find "ERROR_LEVEL" and set its statement to something like that: Config::Set('ERROR_LEVEL', E_ALL ^ E_NOTICE); That should hide all the warnings. Quote Link to comment Share on other sites More sharing options...
djtiger76 Posted April 5, 2020 Author Report Share Posted April 5, 2020 (edited) 3 hours ago, ProAvia said: The first thing I would do is to verify that the directory phpVMS is in is using PHP 5.6 and not some version of PHP7. You shouldn't get that error in PHP 5.6 .  Create a phpinfo.php file to check the PHP info of the phpVMS directory. https://mediatemple.net/community/products/dv/204643880/how-can-i-create-a-phpinfo.php-page  @ProAvia I have been getting all kinds of PHP 7 errors. My php version is set to 5.6 and running phpvms 5.5.2. I don't know why I am running 7.2.29 per phpinfo or how to change it to what it should be.http://www.test.americanva.org/phpinfo.php@servetas I sent you a ticket for the academy that has an error in the admin panel. Could the be the reason for it? Edited April 5, 2020 by djtiger76 Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted April 5, 2020 Administrators Report Share Posted April 5, 2020 I am not a big fan of just hiding the errors. The error you are seeing is because you are running php 7.2.29 and not php 5.6 Â I would suggest asking your hosting company to help you set the phpVMS directory to use php 5.6 - if they have that php version available. Or.... contact me via PM and provide your cPanel login details and I will take a look. Quote Link to comment Share on other sites More sharing options...
djtiger76 Posted April 5, 2020 Author Report Share Posted April 5, 2020 mp hosting provider TFDi changed their host. So its been causing me a headache for the past couple days. The ability to change php version is no longer available, and im sure they changed my version to 7.2. I put in a ticket with them. Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted April 5, 2020 Administrators Report Share Posted April 5, 2020 Actually there is a way to change the php version on the TFDI servers - as one of my fellow developers uses them and is able to do it. It's in a new section. Let me see if he can point you in the general direction. Quote Link to comment Share on other sites More sharing options...
VectoringDesigns Posted April 5, 2020 Report Share Posted April 5, 2020 (edited) 42 minutes ago, djtiger76 said: mp hosting provider TFDi changed their host. So its been causing me a headache for the past couple days. The ability to change php version is no longer available, and im sure they changed my version to 7.2. I put in a ticket with them. If you log in to the tfdi cpanel scroll the PHP section you are looking for the icon that is labelled multiphp manager. From there select the domain or subdomain with a tick in the check box then upper right side you will see a drop down to select the version you wish to have as the active.  Select and apply and your good to go Edited April 5, 2020 by VectoringDesigns 1 Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted April 5, 2020 Administrators Report Share Posted April 5, 2020 There you go - he was quicker than I thought. Thanks VD Â 1 Quote Link to comment Share on other sites More sharing options...
VectoringDesigns Posted April 5, 2020 Report Share Posted April 5, 2020 Just now, ProAvia said: There you go - he was quicker than I thought. Thanks VD  Not Problem Sir. VD Quote Link to comment Share on other sites More sharing options...
djtiger76 Posted April 5, 2020 Author Report Share Posted April 5, 2020 Got it. It used to be called "Select PHP Version" or something like that. Anyway, I changed it to 5.6 and the errors went away Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted April 5, 2020 Administrators Report Share Posted April 5, 2020 Glad you got it sorted. Quote Link to comment Share on other sites More sharing options...
vFAB Posted May 31, 2021 Report Share Posted May 31, 2021 (edited) Hello Gentlemen, after racking your brain, I found something that can help you in the PHP7 version for this error, follow: Â In my case the error was in this line: if(count($pireps) > 0) Â So I used: if(is_array($seu-array) && count($seu-array) > 0) Â if (is_array ($pireps) && count ($pireps)> 0) Â Hope this helps! hugs! Edited May 31, 2021 by fnbv Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.