CMS MADE SIMPLE FORGE

CGContentUtils

 

[#12153] Return value of CGContentUtils::blockManager() must be an instance of IpBlockManagerDecorator

avatar
Created By: Benoit Rambaud (brambaud)
Date Submitted: Fri Sep 20 02:21:01 -0400 2019

Assigned To: Robert Campbell (calguy1000)
Version: 2.5.2
CMSMS Version: 2.2.11
Severity: Critical
Resolution: Fixed
State: Open
Summary:
Return value of CGContentUtils::blockManager() must be an instance of IpBlockManagerDecorator
Detailed Description:
When trying to install last CGContentUtils version, i got this error :

Fatal error: Uncaught TypeError: Return value of CGContentUtils::blockManager()
must be an instance of IpBlockManagerDecorator, instance of
CGContentUtils\BlockManagerCacheDecorator returned in
/home/brambaud/www/cmsmadesimple/modules/CGContentUtils/CGContentUtils.module.php:194
Stack trace: #0
/home/brambaud/www/cmsmadesimple/modules/CGContentUtils/CGContentUtils.module.php(592):
CGContentUtils->blockManager() #1
/home/brambaud/www/cmsmadesimple/modules/CGContentUtils/method.install.php(64):
CGContentUtils->create_empty_contentblock() #2
/home/brambaud/www/cmsmadesimple/lib/classes/class.CMSModule.php(994):
include('/home/brambaud/...') #3
/home/brambaud/www/cmsmadesimple/lib/classes/class.moduleoperations.inc.php(470):
CMSModule->Install() #4
/home/brambaud/www/cmsmadesimple/lib/classes/class.moduleoperations.inc.php(536):
ModuleOperations->_install_module(Object(CGContentUtils)) #5
/home/brambaud/www/cmsmadesimple/modules/ModuleManager/action.local_install.php(13):
ModuleOperations->InstallModule('CGContentUtils') #6 / in
/home/brambaud/www/cmsmadesimple/modules/CGContentUtils/CGContentUtils.module.php
on line 194

GOT THE SOLUTION :

In CGContentUtils.module.php file :

    protected function blockManager() : IpBlockManagerDecorator
    {
        static $obj;
        if( !$obj ) {
            $obj = new BlockManager($this->GetDb());
            $driver = new cms_filecache_driver(['lifetime'=>7*24*3600]);
            $obj = new BlockManagerCacheDecorator($obj, $driver);
        }
        return $obj;
    }

This function should be :

    protected function blockManager() : BlockManagerCacheDecorator
    {
        static $obj;
        if( !$obj ) {
            $obj = new BlockManager($this->GetDb());
            $driver = new cms_filecache_driver(['lifetime'=>7*24*3600]);
            $obj = new BlockManagerCacheDecorator($obj, $driver);
        }
        return $obj;
    }


History

Comments
avatar
Date: 2019-09-26 09:00
Posted By: stephen cooper (scooper)

can confirm I was getting the same error and that  Benoit's change fixed it for
me.

Thanks Benoit (and Robert too but mostly Benoit in this case).

s.

      
avatar
Date: 2019-10-04 08:50
Posted By: Robert Campbell (calguy1000)

fixed in svn
      
Updates

Updated: 2019-10-04 08:50
description: When trying to install last CGContentUtils version, i got this error : Fatal error: Uncaught TypeError: Return value of CGContentUtils::blockManager() must be an instance of IpBlockManagerDecorator, instance of CGContentUtils\BlockManagerCacheDecorat => When trying to install last CGContentUtils version, i got this error : Fatal error: Uncaught TypeError: Return value of CGContentUtils::blockManager() must be an instance of IpBlockManagerDecorator, instance of CGContentUtils\BlockManagerCacheDecorator
resolution_id: => 7