Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.4.1

Bug #2969 Undefined variables
Submitted: 2004-12-15 04:51 UTC Modified: 2005-10-25 16:49 UTC
From: oancea at gmail dot com Assigned: datenpunk
Status: Closed Package: DB_NestedSet
PHP Version: Irrelevant OS: WIN/LINUX
Roadmaps: (Not assigned)    
Subscription  


 [2004-12-15 04:51 UTC] oancea at gmail dot com
Description: ------------ When trying to use CoolMenu driver, some Undefined variable errors pop`s up. It`s about: Undefined variable: menu_properties in PEAR/DB/NestedSet/CoolMenu.php on line 291 (it appears on javascript, so probably you need to view source of the page) and Notice: Undefined variable: coolMenu in PEAR/DB/NestedSet/CoolMenu.php on line 157 Notice: Undefined variable: coolMenu in PEAR/DB/NestedSet/CoolMenu.php on line 160 But, more to come (without affecting the result): Notice: Undefined offset: 0 in PEAR/DB/NestedSet/CoolMenu.php on line 148 Reproduce code: --------------- The code is provided in docs/CoolMenu_exemple.php To solve the problems, in method _createFromStructure from DB/NestedSet/CoolMenu.php I put: $coolMenu = ''; and in method: _buildMenuProperties from DB/NestedSet/CoolMenu.php I put: $menu_properties = ''; With this 2 changes, I was able to run the exemple code. For the problem with Undefined offset, I just comment the if condition starting with this line: // figure out max length for textfields, increase if necessary--NEEDED? Expected result: ---------------- I exepect the demo from docs to work

Comments

 [2005-07-14 04:51 UTC] mk at kaiser-software dot de
This diff should fix this bug. --- CoolMenu.php.org 2005-07-14 11:30:41.000000000 +0200 +++ CoolMenu.php 2005-07-14 11:46:41.000000000 +0200 @@ -110,6 +110,9 @@ static $rootlevel; + // variable init + $coolMenu = ''; + // always start at level 1 if (!isset($params['currentLevel'])) { $params['currentLevel'] = 1; @@ -145,7 +148,7 @@ $params['structure'][$key]['hit'] = $node['hit'] = true; // figure out max length for textfields, increase if necessary--NEEDED? - if (!$this->_strlenByLevel[$params['currentLevel'] - $this->_levelOffset] || + if (empty($this->_strlenByLevel[$params['currentLevel'] - $this->_levelOffset]) || strlen($node[$params['textField']]) > $this->_strlenByLevel[$params['currentLevel'] - $this->_levelOffset]) { $this->_strlenByLevel[$params['currentLevel'] - $this->_levelOffset] = strlen($node[$params['textField']]); }; @@ -286,6 +289,9 @@ */ function _buildMenuProperties($properties) { + // variable init + $menu_properties = ''; + foreach($properties as $prop_key => $prop_val){ $menu_properties .= $this->_menuName . ".$prop_key=$prop_val\n"; }
 [2005-10-25 16:49 UTC] datenpunk at php dot net
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Sorry for the delay - please verify that it works for you now.