CMS MADE SIMPLE FORGE

AdvancedContent

 

[#7041] Fatal error after update in module manager

avatar
Created By: Andrzej (felek)
Date Submitted: Fri Oct 28 06:24:35 -0400 2011

Assigned To: Georg Busch (nan)
Version: AdvancedContent 0.9
CMSMS Version: 1.10
Severity: Critical
Resolution: Fixed
State: Closed
Summary:
Fatal error after update in module manager
Detailed Description:
Fatal error: Call to a member function GetBlockProperty() on a non-object in
/…/modules/AdvancedContent/contenttype.Content2.php on line 281
Now i cant move back to previous version and fresh instalation didnt help.


History

Comments
avatar
Date: 2011-10-28 08:07
Posted By: Georg Busch (nan)

Try the following:
Uninstall the module and remove it.
Install it via FTP. But before this open the file contenttype.Content2.php and
edit the mentioned line 281. There should be these lines:

		…
# todo: check if this is a good idea to process smarty in params when in
frontend
		if($this->_contentBlocks[$param]->GetBlockProperty('smarty'))
		{
			…

right before this insert these lines:

if(!isset($this->_contentBlocks[$param]) ||
!is_object($this->_contentBlocks[$param]))
		{
return $param; # <- The $param is for testing only to see what block causes
that error
		}

Please tell me what is shown in frontend for the content block.
      
avatar
Date: 2011-10-28 08:20
Posted By: Andrzej (felek)

Now its working.   Thank you very much!
      
avatar
Date: 2011-10-28 08:25
Posted By: Andrzej (felek)

Oh... about content block ... there is nothing except text but i have global
content with this code:

<div class="wojboxes">
{assign var="inside" value="0"}
{assign var="counter" value="1" print="false"}
{assign var="stop" value="0"}
{assign var="permstop" value="0"}

{if $count > 0}
   {foreach from=$nodelist item=node}

{if $node->depth == 2 && $node->prevdepth == 1 && $stop == 1}{assign
var="permstop" value="1"}{/if}
{if $node->depth == 2 && $node->prevdepth == 1}{assign var="stop"
value="1"}{/if}

   {if $permstop != 1}
      {if $node->depth == 2 && $inside == 1}
       {assign var="counter" value="0"}
         {assign var="inside" value="1"}
            </div>
            <div class="box-bottom-l">
               <div class="box-bottom-r">
                  <div class="box-bottom-c"><p class="box-end">&#160;</p></div>
               </div>
               </div>
            </div>
            <div class="wojbox">
               <div class="box-top-l">
               <div class="box-top-r">
               <div class="box-top-c">
<img style="float:left" width="20px"
src="/uploads/images/wojewodztwa/{$node->menutext|lower}.png"
alt="{$node->menutext}"/>
<h2 class="wojtitle"><a
href="{$node->url}">{$node->menutext}</a></h2>
               </div>
               </div>
               </div>
               <div class="box-content">
      {/if}
      {if $node->depth == 2 && $inside == 0}
         {assign var="counter" value="0"}
         {assign var="inside" value="1"}
                   <div class="wojbox">
                <div class="box-top-l">
                <div class="box-top-r">
                <div class="box-top-c">
<img style="float:left" width="20px"
src="/uploads/images/wojewodztwa/{$node->menutext|lower}.png"
alt="{$node->menutext}"/>
<h2 class="wojtitle"><a
href="{$node->url}">{$node->menutext}</a></h2>
                </div>
                </div>
                </div>
                <div class="box-content">
      {/if}


      {if $node->depth == 3 && $counter < 3}
<a class="miasto{$counter++}"
href="{$node->url}">{$node->menutext}</a><br />
      {/if}
   {/if}
   {/foreach}
{/if}
</div>
<div class="box-bottom-l">
                <div class="box-bottom-r">
                <div class="box-bottom-c"><p class="box-end">&#160;</p>
                </div>
                </div>
                </div>
            </div>
</div>
      
avatar
Date: 2011-10-28 08:38
Posted By: Andrzej (felek)

Ok I fount whats was the problem 
there was two blocks: 

{content block="Box Title"}
{content block="Box Content"}

It was showing nothing in previous version and now it generates that error.

Thank you for cooperation!
      
avatar
Date: 2011-10-28 09:11
Posted By: Georg Busch (nan)

Well, first of all: 

Sometimes whitespaces are just evil! ;)

I was able to reproduce this error using {content block=""}.
Since in AC 0.9 blocks are objects it will result in a fatal error if the block
that will be displayed is somehow invalid.
In AC 0.8 blocks where just arrays an therefore this would have result in a
notice or a warning but might be suppressed by the server so you didn't realize
this.

So never use whitespaces in parameter "block".
(Even the default contenttype has problems with that.)
The block param should be seen as a variable name. 
That means no special chars no whitespaces. 
But alphanumeric chars only.
If you want to label a block use the parameter "label".
There you can use whatever you want.

I'll add an additional check in the next release so that should never happen
again.

Thanks for report.
      
avatar
Date: 2011-10-28 12:38
Posted By: Georg Busch (nan)

I fixed this in SVN.
Whatever caused this error it should never cause it again.
If the reason for this error ever occures again it will show in backend a notice
that there is an invalid block. In Frontend it will only show a warning that
there is a block that cannot be access if $config['debug'] is set to true.

But notice: i only was able to reproduce this with an invalid value of the param
"block".
I will consider this as fixed but i'll leave the report 'open' in case there are
more reasons for that error than just a parameter value issue.
      
avatar
Date: 2011-11-08 15:15
Posted By: Georg Busch (nan)

Version 0.9.1 is out
      
Updates

Updated: 2011-11-08 15:15
state: Open => Closed

Updated: 2011-10-28 12:38
resolution_id: 10 => 7
assigned_to_id: 100 => 3991

Updated: 2011-10-28 08:07
description: Fatal error: Call to a member function GetBlockProperty() on a non-object in /home/stencel/dobry-dentysta.org/modules/AdvancedContent/contenttype.Content2.php on line 281 Now i cant move back to previous version and fresh instalation didnt help. => Fatal error: Call to a member function GetBlockProperty() on a non-object in /…/modules/AdvancedContent/contenttype.Content2.php on line 281 Now i cant move back to previous version and fresh instalation didnt help.
resolution_id: => 10