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

Permalink Browser Info Environment
Surveys are broken on 8.4.3 with PHP 7.2 if there are no options defined.

I'm getting the following error:

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

on line 48 of concrete5-8.4.3/concrete/blocks/survey/view.php

`$show_graph = (count($optionNamesAbbrev) && !$_GET['dontGraphPoll'] && $totalVotes > 0);`

See attached image.

To replicate:
1. Run C5-8.4.3 on PHP 7.2
2. Add a Survey block to a page.
3. Type in a question.
4. Leave the options blank.
5. Click "Add"

You should see the error immediately.

--

Background: The problem surveys were imported with the migration tool from a version 6 site. It seems either options were not properly imported, or perhaps subsequent migrations are clobbering option definitions.

1 Attachment


Status: New
View Best Answer
mlocati replied on at Best Answer Permalink Reply
mlocati
benloh replied on at Permalink Reply
Thanks, mlocati!

concrete5 Environment Information

# concrete5 Version
Core Version - 8.4.3
Version Installed - 8.4.3
Database Version - 20180716000000

# concrete5 Packages
All In: The Advanced Member Import Add On by ampersandApps (1.0.5), Login Return (1.0), Migration Tool (0.9.0), NeatNGSX (1.0.0), Parent Link (0.0.1), S3 Storage (3.0.3), Set Study Group (0.0.1), Vimeo Video (1.0.2)

# concrete5 Overrides
blocks/facilitator/view.php, blocks/facilitator/README.txt, blocks/facilitator/controller.php, blocks/facilitator, elements/conversation/message_ReadMe.md, elements/conversation/message.php, elements/conversation/count_header.php, elements/conversation/display.php, elements/conversation/display_ReadMe.md, elements/conversation, single_pages/ngsx_data_dump.php, single_pages/dump.php, tools/conversations/view_ajax.php, tools/conversations/view_ajax_ReadMe.md, tools/conversations/add_message.php, tools/conversations/add_message_ReadMe.md, tools/conversations, src/Conversation/Message/FilteredThreadedList_ReadMe.md, src/Conversation/Message/FilteredMessageList.php, src/Conversation/Message/FilteredMessageList_ReadMe.md, src/Conversation/Message/FilteredThreadedList.php, src/Conversation/Message, src/Conversation

# concrete5 Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
nginx/1.14.0

# Server API
fpm-fcgi

# PHP Version
7.2.10

# PHP Extensions
cgi-fcgi, Core, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, hash, iconv, intl, json, libxml, mbstring, mysqli, mysqlnd, openssl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar, posix, readline, Reflection, session, SimpleXML, soap, sodium, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, xsl, Zend OPcache, zip, zlib

# PHP Settings
max_execution_time - 30
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - -1
max_input_vars - 1000
memory_limit - 128M
post_max_size - 100M
upload_max_filesize - 100M
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5
opcache.max_accelerated_files - 10000
opcache.max_file_size - 0
opcache.max_wasted_percentage - 5

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.2 Safari/605.1.15