<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="https://dev.horde.org/themes/horde//default/feed-rss.xsl" type="text/xsl"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
 <channel> 
  <title>Unexpected return value in /framework/Core/lib/Horde/Core/Tree/Javascript.php</title> 
  <pubDate>Fri, 10 Apr 2026 09:21:02 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/9680</link> 
  <atom:link rel="self" type="application/rss+xml" title="Unexpected return value in /framework/Core/lib/Horde/Core/Tree/Javascript.php" href="https://bugs.horde.org/ticket/9680/rss" /> 
  <description>Unexpected return value in /framework/Core/lib/Horde/Core/Tree/Javascript.php</description> 
 
   
   
  <item> 
   <title>I frequently see the following stack trace in my git install</title> 
   <description>I frequently see the following stack trace in my git install:

HORDE [horde] PHP ERROR: array_keys() [&lt;a href=&#039;function.array-keys&#039;&gt;function.array-keys&lt;/a&gt;]: The first argument should be an
array [pid 10039 on line 50 of &quot;/framework/Core/lib/Horde/Core/Tree/Javascript.php&quot;]
Mar 18 17:31:49 temple HORDE:
1. Horde::menu() /horde/services/portal/index.php:56
#0122. require() /framework/Core/lib/Horde.php:2164
#0123. require() /horde/templates/menu/menu.inc:4
#0124. Horde_Core_Sidebar-&gt;getTree() /horde/services/sidebar.php:27
#0125. Horde_Core_Factory_Tree-&gt;create() /framework/Core/lib/Horde/Core/Sidebar.php:127
#0126. Horde_Tree::factory() /framework/Core/lib/Horde/Core/Factory/Tree.php:79
#0127. Horde_Core_Tree_Javascript-&gt;__construct() /framework/Tree/lib/Horde/Tree.php:53
#0128. array_keys() /framework/Core/lib/Horde/Core/Tree/Javascript.php:50
#0129. Horde::errorHandler()

This fixes the issue for me

diff --git a/framework/Core/lib/Horde/Core/Tree/Javascript.php b/framework/Core/lib/Horde/Core/Tree/Javascript.php                                           
index b8ebb78..66eaace 100644
--- a/framework/Core/lib/Horde/Core/Tree/Javascript.php
+++ b/framework/Core/lib/Horde/Core/Tree/Javascript.php
@@ -37,6 +37,9 @@ class Horde_Core_Tree_Javascript extends Horde_Core_Tree_Html
             isset($_COOKIE[$this-&gt;_instance . &#039;_expanded&#039;])) {
             /* Get current session expanded values. */
             $curr = call_user_func($session[&#039;get&#039;], $this-&gt;_instance, &#039;&#039;);
+            if (empty($curr)) {
+                $curr = array();
+            }

             /* Remove &quot;exp&quot; prefix from cookie value. */
             $exp = explode(&#039;,&#039;, substr($_COOKIE[$this-&gt;_instance . &#039;_expanded&#039;], 3));

... but I do not assume this is the correct fix.</description> 
   <pubDate>Fri, 18 Mar 2011 16:48:38 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/9680#t62446</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in Git for this ticket:

Bug #9680: M</title> 
   <description>Changes have been made in Git for this ticket:

Bug #9680: Make sure value returned is an array

 1 files changed, 1 insertions(+), 1 deletions(-)
http://git.horde.org/horde-git/-/commit/9ecddfe2a89417fc9eab7ceb8c7ab9083e54b293</description> 
   <pubDate>Fri, 18 Mar 2011 16:55:21 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/9680#t62447</link> 
  </item> 
   
  <item> 
   <title>&gt; ... but I do not assume this is the correct fix.

It is </title> 
   <description>&gt; ... but I do not assume this is the correct fix.

It is correct, but the fix I provided is more elegant: it uses the optional 3rd parameter to Horde_Session#get() to indicate an empty array should be returned if the session value is not found.</description> 
   <pubDate>Fri, 18 Mar 2011 16:57:05 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/9680#t62448</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in Git for this ticket:

Bug #9680: C</title> 
   <description>Changes have been made in Git for this ticket:

Bug #9680: Carry the $mask parameter over to the session to actually return an array.

 1 files changed, 2 insertions(+), 2 deletions(-)
http://git.horde.org/horde-git/-/commit/687c7009b13cedec6da34b0b2c0d0a77108a9dc8</description> 
   <pubDate>Fri, 18 Mar 2011 20:02:10 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/9680#t62452</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
