6.0.0-alpha14
7/1/25

[#14950] count(): Parameter must be an array or an object that implements Countable on line 980 of Compose.php
Summary count(): Parameter must be an array or an object that implements Countable on line 980 of Compose.php
Queue IMP
Queue Version 6.2.24
Type Bug
State Resolved
Priority 1. Low
Owners mrubinsk (at) horde (dot) org
Requester mmarx (at) netdmon (dot) de
Created 09/03/2019 (2128 days ago)
Due
Updated 12/05/2019 (2035 days ago)
Assigned
Resolved 12/05/2019 (2035 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
12/05/2019 10:22:07 PM Michael Rubinsky Comment #4
Assigned to Michael Rubinsky
State ⇒ Resolved
Reply to this comment
Committed, thanks.
12/05/2019 10:21:30 PM Git Commit Comment #3 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit 52ebc72bdc21523488102558b949ff31df80cd51
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Thu, 05 Dec 2019 17:19:47 -0500

Bug: 14950  Avoid PHP warning from is_array on potentially empty value.

  M lib/Compose.php

https://github.com/horde/imp/commit/52ebc72bdc21523488102558b949ff31df80cd51
09/27/2019 08:03:18 AM pouyan (dot) azari (at) uni-wuerzburg (dot) de Comment #2 Reply to this comment
Hi,

I had the same error and created this small patch:

diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php
index fca3a4d..4c48cf5 100755
--- a/imp/lib/Compose.php
+++ b/imp/lib/Compose.php
@@ -977,7 +977,7 @@ class IMP_Compose implements ArrayAccess, 
Countable, IteratorAggregate
               ($prefs->isLocked('save_sent_mail') &&
                $prefs->getValue('save_sent_mail')))) {
              /* Keep Bcc: headers on saved messages. */
-            if (count($header['bcc'])) {
+            if (is_array($header['bcc']) && count($header['bcc'])) {
                  $headers->addHeader('Bcc', $header['bcc']);
              }
09/03/2019 08:49:11 AM mmarx (at) netdmon (dot) de Comment #1
Priority ⇒ 1. Low
Patch ⇒ No
Milestone ⇒
Queue ⇒ IMP
Summary ⇒ count(): Parameter must be an array or an object that implements Countable on line 980 of Compose.php
Type ⇒ Bug
State ⇒ Unconfirmed
Reply to this comment
Hi,

I'm not sure if it is related to PHP 7.3 but since I updated, I'm 
seeing the following errors when composing/sending mail.

2019-09-03T10:35:33+02:00 WARN: HORDE [imp] PHP ERROR: count(): 
Parameter must be an array or an object that implements Countable [pid 
833 on line 980 of "/usr/share/horde/imp/lib/Compose.php"]

$ php --version
PHP 7.3.9 (cli) (built: Aug 27 2019 22:52:39) ( NTS )

$ pear list -c pear.horde.org | grep imp
imp                          6.2.24  stable


Kind Regards

Matthias Marx

Saved Queries