CMS MADE SIMPLE FORGE

Menu Manager

 

[#7238] error in menu generation during page loading

avatar
Created By: Roberto Braga (bobonov)
Date Submitted: Wed Nov 23 07:03:14 -0500 2011

Assigned To:
Version: None
CMSMS Version: 1.10.2
Severity: Critical
Resolution: Fixed
State: Closed
Summary:
error in menu generation during page loading
Detailed Description:
so it seem there is some kind of bug as after upgrading to 1.10.2 (is possible
that is present since 1.10 series but I found it now)  I started to have problem
in menu printout during the construction of some pages.

The error I get is
Fatal error: Call to a member function Active() on a non-object in
/var/clients/client1/web2/web/modules/MenuManager/MenuManager.module.php on line
254

Quick FIX
I made a quick fix, probably better method is possible by checking the page
entry status or something similar, but this worked for me.
I looked in to the code and tried to modify  the line 254 from
if($tmpc->Active() && $tmpc->ShowInMenu() )
to
if(is_object($tmpc) && $tmpc->Active() && $tmpc->ShowInMenu() )
and the problem get solved without loosing any menu entry.

How to reproduce the issue
Doing a deeper investigation the issue is related to the position of deactivated
menu entry. When before or after the page that is loaded there is a deactivate
page you get the error.
The strange think is that in the preview (admin page editing) the page works, it
is like if preview and website uses two different approach to printout menu
entries.


History

Comments
avatar
Date: 2012-02-15 09:49
Posted By: Roberto Braga (bobonov)

Error still present in 1.10.3, any plan to take it in charge?
the is confirmed also by other users
http://forum.cmsmadesimple.org/viewtopic.php?f=3&t=58125
      
avatar
Date: 2012-03-27 13:16
Posted By: Chris Vogt (cvogt)

Reproduce steps:
1. make sure you have a menu that unfolds, e.g. {menu collapse='1'
number_of_levels="2"}
2. Create page structure like this:
A
+- B
+- C
3. deactivate page B
4. open page A in your browser
5. see error "Call to a member function Active()"

Fix patch:
<pre>
--- modules/MenuManager/MenuManager.module.php.orig
+++ modules/MenuManager/MenuManager.module.php
@@ -251,7 +251,7 @@ class MenuManager extends CMSModule
              for( $i = 0; $i < count($children); $i++ )
                {
                  $tmpc = $children[$i]->getContent(false,true,true);
-                 if( $tmpc->Active() && $tmpc->ShowInMenu() )
+                 if( is_object($tmpc) && $tmpc->Active() && $tmpc->ShowInMenu()
)
                    {
                      $onenode->children_exist = true;
                      break;
</pre>
      
avatar
Date: 2012-03-28 03:03
Posted By: Chris Vogt (cvogt)

fixed in 0.11 according to forum
      
avatar
Date: 2012-03-28 03:04
Posted By: Chris Vogt (cvogt)

1.11 I mean :)
      
avatar
Date: 2012-04-14 16:07
Posted By: Ronny Krijt (ronnyk)

Fixed in SVN, for 1.11.
      
avatar
Date: 2012-08-02 07:36
Posted By: Rolf (rolf1)

CMSMS 1.11 is released
      
Updates

Updated: 2012-08-02 07:36
state: Open => Closed

Updated: 2012-04-14 16:07
resolution_id: 5 => 7

Updated: 2011-11-23 07:03
resolution_id: => 5
severity_id: 12 => 1
cmsms_version_id: -1 => 29321