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

List:       horde-bugs
Subject:    [Tickets #14581] Array operation on non-array throws warnings - fix available
From:       noreply () bugs ! horde ! org
Date:       2017-02-16 16:46:54
Message-ID: whups-14581-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/14581
------------------------------------------------------------------------------
  Ticket           | 14581
  Erstellt Von     | torben@dannhauer.info
  Zusammenfassung  | Array operation on non-array throws warnings - fix
                   | available
  Warteschlange    | Horde Base
  Version          | Git master
  Typ              | Bug
  Status           | Unconfirmed
  Priorität        | 1. Low
  Milestone        |
  Patch            | 1
  Zuständige       |
------------------------------------------------------------------------------


torben@dannhauer.info (2017-02-16 16:46) hat geschrieben:

The function addArray($item) in  
/home/torben/horde/framework/Core/lib/Horde/Menu.php : line 71

performs array operations on (potential non-arrays). This throws  
warnings caused in multiple lines of the functions and pollutes the  
error log.

The suggest solution is to convert $item to an array before working  
with array operations on it.

The function should be like this:
-----

     /**
      * Add an item to the menu array.
      *
      * @param array $item  The item to add.  Valid keys:
      * <pre>
      * 'class' - (string) CSS classname.
      * 'icon' - (string) Filename of the image icon.
      * 'icon_path' - (string) Non-default directory path for icon.
      * 'onclick' - (string) Onclick javascript.
      * 'target' - (string) HREF target parameter.
      * 'text' - (string) Label.
      * 'url' - (string) Hyperlink.
      * </pre>
      *
      * @return integer  The id (NOT guaranteed to be an array index) of the
      *                  item just added to the menu.
      */
     public function addArray($item)
     {
         $item = array($item);
         if (!isset($item['url'])) {
             $item['url'] = new Horde_Url();
         } elseif (!($item['url'] instanceof Horde_Url)) {
             $item['url'] = new Horde_Url($item['url']);
         }

         $this->_menu[] = array_merge(array(
             'class' => null,
             'icon' => '',
             'icon_path' => null,
             'onclick' => null,
             'target' => '',
             'text' => ''
         ), $item);
     }






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