6.0.0-beta1
7/8/25

[#9680] Unexpected return value in /framework/Core/lib/Horde/Core/Tree/Javascript.php
Summary Unexpected return value in /framework/Core/lib/Horde/Core/Tree/Javascript.php
Queue Horde Framework Packages
Queue Version Git master
Type Bug
State Resolved
Priority 1. Low
Owners
Requester wrobel (at) horde (dot) org
Created 03/18/2011 (5226 days ago)
Due
Updated 03/18/2011 (5226 days ago)
Assigned
Resolved 03/18/2011 (5226 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
03/18/2011 08:02:10 PM Git Commit Comment #4 Reply to this comment
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
03/18/2011 04:57:05 PM Michael Slusarz Comment #3
State ⇒ Resolved
Reply to this comment
... 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.
03/18/2011 04:55:21 PM Git Commit Comment #2 Reply to this comment
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
03/18/2011 04:48:38 PM Gunnar Wrobel Comment #1
Priority ⇒ 1. Low
Patch ⇒ No
Milestone ⇒
Queue ⇒ Horde Framework Packages
Summary ⇒ Unexpected return value in /framework/Core/lib/Horde/Core/Tree/Javascript.php
Type ⇒ Bug
State ⇒ Unconfirmed
Reply to this comment
I frequently see the following stack trace in my git install:

HORDE [horde] PHP ERROR: array_keys() [<a 
href='function.array-keys'>function.array-keys</a>]: The first 
argument should be an
array [pid 10039 on line 50 of 
"/framework/Core/lib/Horde/Core/Tree/Javascript.php"]
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->getTree() /horde/services/sidebar.php:27
#0125. Horde_Core_Factory_Tree->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->__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->_instance . '_expanded'])) {
              /* Get current session expanded values. */
              $curr = call_user_func($session['get'], $this->_instance, '');
+            if (empty($curr)) {
+                $curr = array();
+            }

              /* Remove "exp" prefix from cookie value. */
              $exp = explode(',', substr($_COOKIE[$this->_instance . 
'_expanded'], 3));

... but I do not assume this is the correct fix.

Saved Queries