Editing (updating) Conversation mesage results in "An unspecified error occurred"

Permalink 0 0 Browser Info Environment
Problem:

When I try to edit an existing conversation message, clicking "Save" results in an error message "An unspecified error occurred".


To Reproduce:

1. Add a Conversation block
2. Post a message
3. Edit the message
4. Click "Save" button
5. "An unspecified error occurred" is displayed.

Digging further, the PHP error is:
`count(): Parameter must be an array or an object that implements Countable`

```
args: [2, "count(): Parameter must be an array or an object that implements Countable",…]
class: "Whoops\Run"
file: ".../concrete/tools/conversations/update_message.php"
function: "handleError"
line: 36
```

The line is

`$attachmentsToAddCount = count($_POST['attachments']);`

I assume the problem arises when there are no attachments so `count()` is called on non-countable object.


Status: New

concrete5 Environment Information

# concrete5 Version
Core Version - 8.5.2
Version Installed - 8.5.2
Database Version - 20190925072210

# Database Information
Version: 10.4.10-MariaDB-1:10.4.10+maria~bionic
SQL Mode: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

# concrete5 Packages
NeatNGSX (1.0.0)

# concrete5 Overrides
blocks/hello_world/add.php, blocks/hello_world/icon.png, blocks/hello_world/controller.php, blocks/hello_world/db.xml, blocks/hello_world/view.php, blocks/hello_world/edit.php, blocks/hello_world/form.php, blocks/hello_world, blocks/facilitator/controller.php, blocks/facilitator/view.php, blocks/facilitator/README.txt, blocks/facilitator, blocks/survey/controller.php, blocks/survey/option.php, blocks/survey/db.xml, blocks/survey/view.php, blocks/survey/ReadMe.txt, blocks/survey, elements/conversation/message_ReadMe.md, elements/conversation/count_header.php, elements/conversation/display.php, elements/conversation/display_ReadMe.md, elements/conversation/message.php, elements/conversation, js/conversations.js, single_pages/versions.php, single_pages/dump.php, single_pages/versions_ReadMe.md, single_pages/dashboard/users/group_sets.php, single_pages/dashboard/users, single_pages/dashboard, single_pages/ngsx_data_dump.php, tools/conversations/message_page.php, tools/conversations/update_message_ReadMe.md, tools/conversations/add_message_ReadMe.md, tools/conversations/view_ajax.php, tools/conversations/view_ajax_ReadMe.md, tools/conversations/update_message.php, tools/conversations/add_message.php, tools/conversations, src/User/Group, src/User, 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.16.1

# Server API
fpm-fcgi

# PHP Version
7.3.9

# 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_pgsql, pdo_sqlite, pgsql, Phar, posix, readline, redis, Reflection, session, SimpleXML, soap, sodium, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, xsl, Zend OPcache, zip, zlib

# PHP Settings
max_execution_time - 120
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - -1
max_input_vars - 1000
memory_limit - 256M
post_max_size - 100M
upload_max_filesize - 100M
mbstring.regex_stack_limit - 100000
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
pgsql.max_links - Unlimited
pgsql.max_persistent - Unlimited
redis.pconnect.connection_limit - 0
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_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36