Jump to content

Webservice count(): Parameter must be an array or an object that implements Countable


johnymas
 Share

Recommended Posts

Due to this warning below webservice  will not work at all

[PHP Warning #2] count(): Parameter must be an array or an object that implements Countable (/var/www/clients/client17/web51/web/classes/webservice/WebserviceRequest.php, line 800)

 

So we have to change line 800 from

if (count(self::$shopIDs)) {

to

if (self::$shopIDs && count(self::$shopIDs)) {

 

We use the latest version of prestashop 1.7.4.3 which have to be compatible with php 7.2. ??
 

Share this post


Link to post
Share on other sites

  • 8 months later...
  • 11 months later...
  • 5 months later...

When I install the new prestashop 1.7.7  and it upgraded me to PHP 7.2 and I'm getting this error on the web page (picture)

this is the code on the php page 

public function hookdisplayNav2($param) {
        $id_shop = (int)Context::getContext()->shop->id;
        $staticBlocks = $this->_staticModel->getStaticblockLists($id_shop,'displayNav2');
        if(count($staticBlocks)<1) return null;
        $this->smarty->assign(array(
            'staticblocks' => $staticBlocks,
        ));
       return $this->display(__FILE__, 'views/templates/block.tpl');
    }

Im not getting any syntax error 

any help on fixing this thanks 

Screenshot (29).png

Share this post


Link to post
Share on other sites

  • 1 month later...
  • 3 months later...
  • 5 months later...
  • 4 months later...
On 6/16/2020 at 5:08 AM, norman_12 said:

@caovillanueva i having the same problem, and i'm newbie can you please tell how you changed the PHP version to 7.0

Depends what program you are using to run websites (XAMP, LARAGON, EASYPHP). Check the preferences to switch the PHP ver.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More