[prev in list] [next in list] [prev in thread] [next in thread] 

List:       horde-bugs
Subject:    [Tickets #14580] Gollem Auth thorws warning and pollutes Errorlog - fix available
From:       noreply () bugs ! horde ! org
Date:       2017-02-16 16:01:27
Message-ID: whups-14580-40da5920f32557c0a3e3eec1fb8a2e62 () bugs ! horde ! org
[Download RAW message or body]

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@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@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



-- 
bugs mailing list
Frequently Asked Questions: http://wiki.horde.org/FAQ
To unsubscribe, mail: bugs-unsubscribe@lists.horde.org
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic