Page 1 of 1

Uncaught TypeError: count()

Posted: Thu May 11, 2023 9:30 pm
by krolli
Script: admin_ticket.php
Hesk version: 3.4.3

Hey! :D

Code: Select all

PHP Warning:  Undefined variable $attachments in (...) /admin/admin_ticket.php on line 378
PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in (...) /admin/admin_ticket.php:378
This error happens if you have attachments turned Off and you want to post a note and also you are on >=PHP8.0 ("count() will now throw TypeError on invalid countable types passed to the value parameter.").

Line 378:

Code: Select all

if ( count($attachments) || strlen($msg) || count($hesk_error_buffer) )
My quick-fix solution:

Code: Select all

if ( (!empty($attachments) && count($attachments)) || strlen($msg) || count($hesk_error_buffer) )
Thanks :wink:

Re: Uncaught TypeError: count()

Posted: Fri May 12, 2023 5:52 am
by Klemen
Thanks for reporting it - the fix will be included in the next release.