Jump to content

count error


Peter Knight
 Share

Recommended Posts

I'm getting the following error. Having posted it in the GitHub I realise I should post it here instead.

Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/domain.com/httpdocs/site/assets/cache/FileCompiler/site/modules/MarkupSEO/MarkupSEO.module on line 245

I know MarkupSEO is an old and relatively discontinued Module these days but was hoping to fix by upgrading both PHP and PW to latter versions.

I am now running ProcessWire 3.0.148 © 2020 and PHP 7.3.13

Issue persists.

Link to comment
Share on other sites

32 minutes ago, BitPoet said:

You could either use the fork by esl51 or incorporate the fix yourself (changing the "count" in line 245 to "!empty"). Maybe someone actively using the module could talk with @Nico Knoll about maintining the module on GitHub? There's already a pull request that fixes this waiting in the repo.

Cheers BitPoet. That worked.

Is there a similar fix for the next error that appears?

Quote

Notice: Trying to get property 'httpUrl' of non-object in /var/www/vhosts/domain.com/httpdocs/site/assets/cache/FileCompiler/site/modules/MarkupSEO/MarkupSEO.module on line 248

 

 

Link to comment
Share on other sites

You should be able to replace the try/catch block with this if clause, but this is untested (I'm not using the module anywhere):

							$imgSmart = $page->get(implode('|', $configData['imageSmart']));
							if($imgSmart instanceof WireArray) {
								$pageData['image'] = $imgSmart->first()->httpUrl;
							} else {
								$pageData['image'] = $imgSmart->httpUrl;
							}

 

  • Like 1
Link to comment
Share on other sites

I believe it is also fixed in: https://github.com/adrianbj/MarkupSEO/commits/various-fixes-enhancements

As far as I know, this is the most improved version of the original module available - lots of bug fixes and improvements. That said, I am not maintaining it anymore, but if anyone wants to keep it going, I would start from that version. Otherwise, take a look at SEOMaestro.

  • Like 2
Link to comment
Share on other sites

39 minutes ago, adrian said:

I believe it is also fixed in: https://github.com/adrianbj/MarkupSEO/commits/various-fixes-enhancements

As far as I know, this is the most improved version of the original module available - lots of bug fixes and improvements. That said, I am not maintaining it anymore, but if anyone wants to keep it going, I would start from that version. Otherwise, take a look at SEOMaestro.

Thanks Adrian. When installed, does this version inherit the existing settings etc?

Link to comment
Share on other sites

Just now, Peter Knight said:

Thanks Adrian. When installed, does this version inherit the existing settings etc?

There were some changes to module settings and functionality so no guarantees on this I'm afraid. There were just too many bugs in the old version that I got beyond caring about ensuring backward compatibility and I was installing on a new site. I think you should test on a dev site first to see if it breaks anything before running on a production site.

  • Like 1
Link to comment
Share on other sites

2 minutes ago, adrian said:

There were some changes to module settings and functionality so no guarantees on this I'm afraid. There were just too many bugs in the old version that I got beyond caring about ensuring backward compatibility and I was installing on a new site. I think you should test on a dev site first to see if it breaks anything before running on a production site.

Fair enough. Thanks ?

Link to comment
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...