6.0.0-git
2020-02-24

[#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 2019-09-03 (174 days ago)
Due
Updated 2019-12-05 (81 days ago)
Assigned
Resolved 2019-12-05 (81 days ago)
Milestone
Patch No

History
2019-12-05 22:22:07 Michael Rubinsky Comment #4
Assigned to Michael Rubinsky
State ⇒ Resolved
Reply to this comment
Committed, thanks.
2019-12-05 22:21:30 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
2019-09-27 08:03:18 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']);
              }
2019-09-03 08:49:11 mmarx (at) netdmon (dot) de Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 1. Low
Summary ⇒ count(): Parameter must be an array or an object that implements Countable on line 980 of Compose.php
Queue ⇒ IMP
Milestone ⇒
Patch ⇒ No
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