6.0.0-alpha14
6/30/25

[#14523] Invalid argument supplied for foreach() (gollem/lib/Auth.php)
Summary Invalid argument supplied for foreach() (gollem/lib/Auth.php)
Queue Gollem
Queue Version Git master
Type Bug
State Resolved
Priority 1. Low
Owners jan (at) horde (dot) org
Requester horde.wayne (at) ptaff (dot) ca
Created 11/26/2016 (3138 days ago)
Due
Updated 10/20/2017 (2810 days ago)
Assigned 01/13/2017 (3090 days ago)
Resolved 02/01/2017 (3071 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
10/20/2017 08:33:15 PM Git Commit Comment #5 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit 18fc040ad5312348d34fb99d4611c416f7eb3a65
Author: Jan Schneider <jan@horde.org>
Date:   Fri, 13 Jan 2017 22:04:07 +0100

Try to get rid of "Invalid argument supplied for foreach()" from Gollem.

For one, we have been using an invalid flag for $session->get(). Make 
sure it returns an array.
Besides that, store the passwords array in the session, even if empty.

Bug: 14523

  M lib/Auth.php

https://github.com/horde/gollem/commit/18fc040ad5312348d34fb99d4611c416f7eb3a65
02/01/2017 09:33:21 AM Jan Schneider State ⇒ Resolved
 
01/13/2017 09:04:27 PM Git Commit Comment #4 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit 726eb303b5fa088eceb29edd72c3647fb85d1b1d
Author: Jan Schneider <jan@horde.org>
Date:   Fri Jan 13 21:59:16 2017 +0100

     Try to get rid of "Invalid argument supplied for foreach()" from Gollem.

     For one, we have been using an invalid flag for $session->get(). 
Make sure it returns an array.
     Besides that, store the passwords array in the session, even if empty.

     Bug: 14523

  gollem/lib/Auth.php | 14 +++++---------
  1 file changed, 5 insertions(+), 9 deletions(-)

http://github.com/horde/horde/commit/726eb303b5fa088eceb29edd72c3647fb85d1b1d
01/13/2017 08:59:45 PM Jan Schneider Comment #3
Assigned to Jan Schneider
State ⇒ Feedback
Reply to this comment
Does this fix it?
01/13/2017 08:59:36 PM Git Commit Comment #2 Reply to this comment
Changes have been made in Git (master):

commit 35ddcfa640500a3af72d72ffc78741415d7e7498
Author: Jan Schneider <jan@horde.org>
Date:   Fri Jan 13 21:59:16 2017 +0100

     Try to get rid of "Invalid argument supplied for foreach()" from Gollem.

     For one, we have been using an invalid flag for $session->get(). 
Make sure it returns an array.
     Besides that, store the passwords array in the session, even if empty.

     Bug: 14523

  gollem/lib/Auth.php | 14 +++++---------
  1 file changed, 5 insertions(+), 9 deletions(-)

http://github.com/horde/horde/commit/35ddcfa640500a3af72d72ffc78741415d7e7498
11/26/2016 07:57:11 PM horde (dot) wayne (at) ptaff (dot) ca Comment #1
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ Invalid argument supplied for foreach() (gollem/lib/Auth.php)
Queue ⇒ Gollem
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
Reply to this comment
I get these once in a while in syslog, under a Horde-5.2.6 webmail 
installation.

[gollem] PHP ERROR: Invalid argument supplied for foreach() [pid 8891 
on line 338 of "?/gollem/lib/Auth.php"]

Tracing the behaviour, it appears the following code line 336:

   $passwords = $session->get('gollem', 'backends_password', 
$session::ENCRYPT);

does not always assign an array, sometimes it assigns a binary string 
(related to the json_encode() behavior described in bug #14522 
perhaps?):

I'd hence suggest, if this binary string behavior is to be expected, 
to change line 337 from:

   if ($passwords) {

to:

   if (is_array($passwords)) {

so that this syslog message is silenced.

Thanks!

Saved Queries