count(): Parameter must be an array or an object that implements Countable in C:\htdocs..\components\com_jcomments\tpl\joomspirit_theme\tpl_form.php
$customBBCodes = $this->getVar('comments-form-custombbcodes');
if (count($customBBCodes)) {
foreach($customBBCodes as $code) {
if ($code->button_enabled) {
$k = 'custombbcode' . $code->id;
$title = trim(JCommentsText::jsEscape($code->button_title));
$text = empty($code->button_prompt) ? JText::_('BBCODE_HINT_ENTER_TEXT') : JText::_($code->button_prompt);
$open_tag = $code->button_open_tag;
$close_tag = $code->button_close_tag;
$icon = $code->button_image;
$css = $code->button_css;
}
}
}
I am running this script in my Joomla 3.0 application with PHP7.3 on Apache.
must add
if(is_array($customBBCodes)){
all change to
`$customBBCodes = $this->getVar('comments-form-custombbcodes');
if(is_array($customBBCodes)){
if (count($customBBCodes)) {
foreach($customBBCodes as $code) {
if ($code->button_enabled) {
$k = 'custombbcode' . $code->id;
$title = trim(JCommentsText::jsEscape($code->button_title));
$text = empty($code->button_prompt) ? JText::_('BBCODE_HINT_ENTER_TEXT') : JText::_($code->button_prompt);
$open_tag = $code->button_open_tag;
$close_tag = $code->button_close_tag;
$icon = $code->button_image;
$css = $code->button_css;`