Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
timbocode opened this issue Sep 12, 2020 · 5 comments · Fixed by #264
Closed

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

timbocode opened this issue Sep 12, 2020 · 5 comments · Fixed by #264
Milestone

Comments

@timbocode
Copy link
Contributor

Details of issue

This occurs in in classic-commerce/includes/class-wc-update-client.php on line 662

Comment on Slack:

I've been noticing often when I update a site's CP version or switch from WP to CP I get 2 warning messages in my php log like:

PHP Warning:  count(): Parameter must be an array or an object that implements Countable in classic-commerce/includes/class-wc-update-client.php on line 662

This one was from the recent move of my last site to CP.

It seems related to the Update Manager client. It doesn't happen with my utility plugin update client (which is on the latest version of that client file). It was happening with another plugin I use that had the older version, and with CC that also has the older version.

The message only comes up twice, then never again.

and

I just updated another CP site from 1.1.4 to 1.2.0-rc2. Same thing - this message twice in admin error log.
@timbocode timbocode added this to the Version 1.0.0 milestone Sep 12, 2020
@ghost
Copy link

ghost commented Sep 12, 2020

I copied the latest version of the update manager client file into a test site, renamed it class-wc-update-client.php and made the few necessary changes to the code (edit namespace, update server and image path).

I then upgraded that site from 1.1.4 to 1.2.0-rc2. No error messages appeared.

@ghost
Copy link

ghost commented Sep 12, 2020

I then manually changed the version number of CC from Version: 1.0.0-rc.2 to Version: 1.0.0-rc.1, went into the site and ran the update process.

That all worked. No errors logged.

@ghost
Copy link

ghost commented Sep 12, 2020

I suggest the best course of action is to update class-wc-update-client.php to be using the latest version of the update manager client.

@ghost
Copy link

ghost commented Sep 13, 2020

Let me know if you want a PR for this.

@timbocode
Copy link
Contributor Author

An issue to update Update Manager was mentioned in #211 but I was concerned it might be too much of a significant change just before v1 so it didn't go any further. With hindsight, it probably should have been done then, although I wasn't aware that it was producing errors at that time.

So, yes please @simplycomputing, if you could create a PR then we'll get this into v1. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant