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

Permalink
Today on PHP mysteries:
Logging in to several of my sites, I get this behavior:
The top bar appears with all the dashboard controls.
The error message in the title presents itself.
The login window is still there. See the attached screenshot.
I can navigate anywhere in the site and make changes that save, but I have to start out by going to the sitemap and "visiting" home.
I think it's a little much to ask my editors to do this workaround, but I have no clue why this happens.
I have tried changing the login destination in the System & Settings page. No dice.




# concrete5 Version
Core Version - 8.3.1
Version Installed - 8.3.2
Database Version - 20171218000000
# concrete5 Packages
Advanced Phonebook Pro Plus (0.9.1), Black box (0.9.0), Centry (2.1.4), Deluxe Customizable Twitter Feed (1.0), Editor Comment (7.0), Global Version List (1.0), Handyman (1.1.0), Header Blocks (0.9.0), Highlight Links 2.0 (g) (2.0.0), List files from set (1.0.12), Login Log (1.0), Manual Nav (2.1.1), Page Activity (0.9.3), PDF Viewer (1.0.1), Phone Alpha Navigator (0.9.0), Phonebook Alpha (0.9.0), Quick Tabs (1.0), Red Alert Box (0.9.0), Redirect (1.0.0), Responsive Embed (1.0.1), Service data box H (0.9.0.1), Simple Slider (1.0), Spacer (0.9.3), Stucco (1.1.3), SVG Social Media Icons (0.9.9), Vivid Carousel (1.0.1), White Label (1.0.1), Wrap anything (0.9.2), Yellow Alert Box (0.9.0)
# concrete5 Overrides
blocks/advanced_phonebook_pro/composer.php, blocks/advanced_phonebook_pro/icon.png, blocks/advanced_phonebook_pro/form.php, blocks/advanced_phonebook_pro/js_form/handlebars-helpers.js, blocks/advanced_phonebook_pro/js_form/handlebars-v4.0.4.js, blocks/advanced_phonebook_pro/js_form, blocks/advanced_phonebook_pro/css_form/repeatable-ft.form.css, blocks/advanced_phonebook_pro/css_form, blocks/advanced_phonebook_pro/auto.js, blocks/advanced_phonebook_pro/db.xml, blocks/advanced_phonebook_pro/controller.php, blocks/advanced_phonebook_pro/edit.php, blocks/advanced_phonebook_pro/add.php, blocks/advanced_phonebook_pro/config.json, blocks/advanced_phonebook_pro/view.php, blocks/advanced_phonebook_pro, blocks/aPhonebookPro.tgz
# concrete5 Cache Settings
Block Cache - On
Overrides Cache - On
Full Page Caching - On - If blocks on the particular page allow it.
Full Page Cache Lifetime - Every 6 hours (default setting).
# Server Software
Apache

1 Attachment

yfsneals
 
Gondwana replied on at Permalink Best Answer Reply
Gondwana
Long shot: try dropping back to php 7.1.
mesuva replied on at Permalink Reply
mesuva
Pretty certain that will fix it.

Longer term, it might be worth turning on full debug detail via: /index.php/dashboard/system/environment/debug
and trying to get it to output enough error messages that you can spot which of your installed add-ons is the cause. If you can work out which one, you can then decide if an update is required or contact the author to let them know that may need to update their add-on.

I've hit this a few times lately myself, cases where you try do a count on what you think is an array, but the thing you are counting might be a value like 'false'. In PHP7.1 and lower, it just returns a 0, but in 7.2 you can't do that. The fix is just to check that your object is at least an array before calling count on it.
yfsneals replied on at Permalink Reply
yfsneals
I do try to switch it to the full debug version, but it doesn't accept any of that.
surefyre replied on at Permalink Reply 1 Attachment
surefyre
Isn't 8.3.x supposed to work under PHP7.2?

I'm getting this but on a bog standard template change under Design with no special code other than declaring a Global Area in the template being switched to, see attached.

Should a bug be raised?

# concrete5 Version
Core Version - 8.3.2
Version Installed - 8.3.2
Database Version - 20180122213656
MindsAlikeMedia replied on at Permalink Reply
MindsAlikeMedia
Thank you friend. Also everyone just be aware of hosts that automatically update your PHP version. Of course we'd like to be on the latest version of everything, but we also would rather use something solid over Wordpress x
yfsneals replied on at Permalink Reply
yfsneals
FYSA, dropping back PHP a version worked.