[Tickets #14580] Gollem Auth thorws warning and pollutes Errorlog - fix available

noreply at bugs.horde.org noreply at bugs.horde.org
Thu Feb 16 16:01:27 UTC 2017


BITTE NICHT AUF DIESE NACHRICHT ANTWORTEN. NACHRICHTEN AN DIESE  
E-MAIL-ADRESSE WERDEN NICHT GELESEN.

Ticket-URL: https://bugs.horde.org/ticket/14580
------------------------------------------------------------------------------
  Ticket           | 14580
  Erstellt Von     | torben at dannhauer.info
  Zusammenfassung  | Gollem Auth thorws warning and pollutes Errorlog - fix
                   | available
  Warteschlange    | Gollem
  Version          | Git master
  Typ              | Bug
  Status           | Unconfirmed
  Priorität        | 1. Low
  Milestone        |
  Patch            | 1
  Zuständige       |
------------------------------------------------------------------------------


torben at dannhauer.info (2017-02-16 16:01) hat geschrieben:

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





More information about the bugs mailing list