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

Fix PHP count() warning #534

Merged
merged 1 commit into from
Oct 31, 2019
Merged

Fix PHP count() warning #534

merged 1 commit into from
Oct 31, 2019

Conversation

mjangda
Copy link
Member

@mjangda mjangda commented Oct 31, 2019

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

Switch to a another instance var that tracks the module count rather than trying to force the modules object into an array and back.

Fixes #498

To Test

  1. Make sure you're using PHP 7.2 or newer and WP_DEBUG is set.
  2. Goto /wp-admin/admin.php?page=ef-settings
  3. Should see the warning.
  4. Apply patch.
  5. Refresh page and verify that error is gone and page renders correctly.

```
PHP Warning: count(): Parameter must be an array or an object that implements Countable
```

Switch to a another instance var that tracks the module count rather
than trying to force the modules object into an array and back.
Copy link
Contributor

@dchymko dchymko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed fixed in 7.2.

FYI this issue doesn't appear to occur in PHP 7.3.4

@dchymko dchymko merged commit 259321a into master Oct 31, 2019
@GaryJones GaryJones deleted the fix/php72-count-modules branch December 9, 2019 15:02
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 this pull request may close these issues.

PHP7.2 Warning in settings.php due to not Countable object
2 participants