6.0.0-beta1
7/4/25

[#14580] Gollem Auth thorws warning and pollutes Errorlog - fix available
Summary Gollem Auth thorws warning and pollutes Errorlog - fix available
Queue Gollem
Queue Version Git master
Type Bug
State Not Reproducible
Priority 1. Low
Owners mrubinsk (at) horde (dot) org
Requester torben (at) dannhauer (dot) info
Created 02/16/2017 (3060 days ago)
Due
Updated 04/03/2017 (3014 days ago)
Assigned 02/24/2017 (3052 days ago)
Resolved 04/03/2017 (3014 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch Yes

History
04/03/2017 01:28:00 PM Michael Rubinsky State ⇒ Not Reproducible
 
04/03/2017 01:24:39 PM torben (at) dannhauer (dot) info Comment #8 Reply to this comment

[Show Quoted Text - 9 lines]
Mike,

using the current set of stable pear packages of Horde, I'm also not 
able to reproduce it.

I recommend to close the bug. Thanks for your help.
03/02/2017 09:35:12 PM torben (at) dannhauer (dot) info Comment #7 Reply to this comment
Can you see what $passwords is equal to right before the for loop?

When it did break for me, it was an unencrypted binary string when 
the original $password array contained a single entry in element 
(int)0. If the entry was "moved" to element '1', it worked but I 
can't get it to break again. It's always returned as an array now.
I'll check that, but I'm on the road for four days. I'll come back to 
this issue on Tuesday or Wednesday.
03/02/2017 05:48:43 PM Michael Rubinsky Comment #6 Reply to this comment
Can you see what $passwords is equal to right before the for loop?

When it did break for me, it was an unencrypted binary string when the 
original $password array contained a single entry in element (int)0. 
If the entry was "moved" to element '1', it worked but I can't get it 
to break again. It's always returned as an array now.
03/02/2017 05:40:33 PM Michael Rubinsky Comment #5 Reply to this comment
There seems to be some issue with decompressing certain arrays with 
numeric keys. I've been able to reproduce it on one machine using 
PHP 5.6, but not on my dev machine running php 7.

Still investigating.
....and now I can't reproduce it at all :(
03/02/2017 05:31:20 PM torben (at) dannhauer (dot) info Comment #4 Reply to this comment
There seems to be some issue with decompressing certain arrays with 
numeric keys. I've been able to reproduce it on one machine using 
PHP 5.6, but not on my dev machine running php 7.

Still investigating.
Thanks for the update
03/02/2017 05:03:25 PM Michael Rubinsky Comment #3
Taken from Horde DevelopersHorde Developers
Reply to this comment
There seems to be some issue with decompressing certain arrays with 
numeric keys. I've been able to reproduce it on one machine using PHP 
5.6, but not on my dev machine running php 7.

Still investigating.
02/24/2017 05:55:59 PM Michael Rubinsky Assigned to Horde DevelopersHorde Developers
Assigned to Michael Rubinsky
State ⇒ Assigned
 
02/24/2017 05:55:32 PM Michael Rubinsky Comment #2 Reply to this comment
The real question is why is a non-array value returned from 
$session->get when the TYPE_ARRAY mask is passed? Perhaps it's an 
issue in Horde_Session when a value is saved with the ENCRYPT mask but 
retrieved with the TYPE_ARRAY mask.
02/16/2017 04:01:27 PM torben (at) dannhauer (dot) info Comment #1
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ Gollem Auth thorws warning and pollutes Errorlog - fix available
Queue ⇒ Gollem
Milestone ⇒
Patch ⇒ Yes
State ⇒ Unconfirmed
Reply to this comment
Gollem Auth (gollem/lib/Auth.php ~line 340) throws warnings: "PHP 
ERROR: Invalid argument supplied for foreach()"

Since the causing function _getBackends() is invoked several times, it 
pollutes the logfile.

In the mentioned function, the passwords are retrieved and iterated 
via foreach. However, if only a singlr password is returned, PHP 
complains that it is no array.

I propose to insert an cast into array to have a defined type 
presented to foreach() to correct the problem.


The fixed function should be like this:


gollem/lib/Auth.php:
     /**
      * Return stored backend list.
      *
      * @return array  Backend configuration list.
      */
     protected static function _getBackends()
     {
         global $session;

         if (($backends = $session->get('gollem', 'backends', 
$session::TYPE_ARRAY)) &&
             ($passwords = $session->get('gollem', 
'backends_password', $session::TYPE_ARRAY))) {
             foreach ( (array) $passwords as $key => $val) {
                 $backends[$key]['params']['password'] = $val;
             }
         }

         return $backends;
     }


Thanks,
Torben

Saved Queries