quickapps / cms

Modular CMS powered by CakePHP
GNU General Public License v3.0
164 stars 69 forks source link

An Internal Error Has Occurred. (Behavior class TreeBehavior could not be found.) #181

Closed nrj4all closed 6 years ago

nrj4all commented 6 years ago

Hello, I've installed QACMS and I can access the page, are able to login and visit the Dashboard. But when I try to edit or add something within the admin center I'm getting an error: "Error
An Internal Error Has Occurred."

I reinstalled QACMS and deleted the snapshot.php.

Thanks in advance!

errors.log

2017-09-28 16:41:26 Error: [Cake\ORM\Exception\MissingBehaviorException] Behavior class TreeBehavior could not be found. in [ROOT]/vendor/cakephp/cakephp/src/ORM/BehaviorRegistry.php on line 115 Request URL: /en_US/admin/media_manager/explorer Referer URL: http://qacms.dev/en_US/admin Client IP: 10.0.0.5 Stack Trace:

0 [ROOT]/vendor/cakephp/cakephp/src/Core/ObjectRegistry.php(340): Cake\ORM\BehaviorRegistry->_throwMissingClassError('Tree', NULL)

1 [ROOT]/vendor/cakephp/cakephp/src/ORM/Table.php(848): Cake\Core\ObjectRegistry->unload('Tree')

2 [ROOT]/vendor/quickapps-plugins/menu/src/Controller/Component/BreadcrumbComponent.php(95): Cake\ORM\Table->removeBehavior('Tree')

3 [ROOT]/vendor/quickapps-plugins/media-manager/src/Controller/Admin/ExplorerController.php(31): Menu\Controller\Component\BreadcrumbComponent->push('/admin/media_ma...')

4 [ROOT]/vendor/cakephp/cakephp/src/Controller/Controller.php(440): MediaManager\Controller\Admin\ExplorerController->index()

5 [ROOT]/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(119): Cake\Controller\Controller->invokeAction()

6 [ROOT]/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(93): Cake\Http\ActionDispatcher->_invoke(Object(MediaManager\Controller\Admin\ExplorerController))

7 [ROOT]/vendor/cakephp/cakephp/src/Routing/Dispatcher.php(60): Cake\Http\ActionDispatcher->dispatch(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))

8 [ROOT]/webroot/index.php(37): Cake\Routing\Dispatcher->dispatch(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))

9 {main}

php -v PHP 5.6.30-0+deb8u1 (cli) (built: Apr 14 2017 16:20:58)

botchris commented 6 years ago

could you please provided the content of your composer.lock file ? My guess is that something is not working with the Aspect Engine

nrj4all commented 6 years ago

deleted due to unreadable post .. uploaded txt-file instead

nrj4all commented 6 years ago

composer.lock.txt

botchris commented 6 years ago

I've seen similar issues when using latest versions of CakePHP + QACMS (however this is caused by a third-party component used to implement AOP, not QACMS actually).

For what I see, for some reason, your installation is using CakePHP 3.5., but QACMS has only be tested up to CakePHP 3.3.

So try to edit this file: https://github.com/quickapps/website/blob/master/composer.json#L11 and force composer to use any 3.3.* version, 3.3.12 for instance. Edit composer.json, change cakephp version, and then run composer update cakephp/cakephp

nrj4all commented 6 years ago

Oh indeed.. As I can see version 3.5.3 has been installed:

cat vendor/cakephp/cakephp/VERSION.txt 
////////////////////////////////////////////////////////////////////////////////////////////////////
// +--------------------------------------------------------------------------------------------+ //
// CakePHP Version
//
// Holds a static string representing the current version of CakePHP
//
// CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
// Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
//
// Licensed under The MIT License
// Redistributions of files must retain the above copyright notice.
//
// @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
// @link          https://cakephp.org
// @since         CakePHP(tm) v 0.2.9
// @license       https://opensource.org/licenses/mit-license.php MIT License
// +--------------------------------------------------------------------------------------------+ //
////////////////////////////////////////////////////////////////////////////////////////////////////
3.5.3

It seems that the composer.json does not satisfy the dependency needs.

I removed cakephp and installed version 3.3.12 as suggested.

$ cat vendor/cakephp/cakephp/VERSION.txt 
////////////////////////////////////////////////////////////////////////////////////////////////////
// +--------------------------------------------------------------------------------------------+ //
// CakePHP Version
//
// Holds a static string representing the current version of CakePHP
//
// CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
// Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
//
// Licensed under The MIT License
// Redistributions of files must retain the above copyright notice.
//
// @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
// @link          http://cakephp.org
// @since         CakePHP(tm) v 0.2.9
// @license       http://www.opensource.org/licenses/mit-license.php MIT License
// +--------------------------------------------------------------------------------------------+ //
////////////////////////////////////////////////////////////////////////////////////////////////////
3.3.12

Now I get a couple of error messages:

Not even the frontend-page is able to load due to server error 500.

$ cat logs/errors.log 
2017-09-28 20:46:05 Error: Fatal Error (256): [BadMethodCallException] Method getParam does not exist
#0 [ROOT]/tmp/aop/vendor/cakephp/cakephp/src/View/Helper/FormHelper.php(2561): Cake\Network\Request->__call('getParam', Array)
#1 [ROOT]/tmp/aop/vendor/cakephp/cakephp/src/View/Helper/FormHelper.php(2561): Cake\Network\Request->getParam('_Token')
#2 [ROOT]/tmp/aop/vendor/cakephp/cakephp/src/View/Helper/FormHelper.php(1653): Cake\View\Helper\FormHelper__AopProxied->_initInputField('idPrefix', Array)
#3 [ROOT]/tmp/aop/vendor/cakephp/cakephp/src/View/Helper/FormHelper.php(281): Cake\View\Helper\FormHelper__AopProxied->__call('getConfig', Array)
#4 [ROOT]/tmp/aop/vendor/cakephp/cakephp/src/View/Helper/FormHelper.php(281): CMS\View\Helper\FormHelper->getConfig('idPrefix')
#5 [ROOT]/tmp/aop/vendor/quickapps-plugins/cms/src/View/Helper/FormHelper.php(51): Cake\View\Helper\FormHelper__AopProxied->__construct(Object(CMS\View\View), Array)
#6 [ROOT]/vendor/cakephp/cakephp/src/View/HelperRegistry.php(145): CMS\View\Helper\FormHelper__AopProxied->__construct(Object(CMS\View\View), Array)
#7 [ROOT]/vendor/cakephp/cakephp/src/Core/ObjectRegistry.php(93): Cake\View\HelperRegistry->_create('CMS\\View\\Helper...', 'Form', Array)
#8 [ROOT]/vendor/cakephp/cakephp/src/View/View.php(1048): Cake\Core\ObjectRegistry->load('Form', Array)
#9 [ROOT]/vendor/cakephp/cakephp/src/View/View.php(947): Cake\View\View->loadHelper('Form', Array)
#10 [ROOT]/vendor/cakephp/cakephp/src/View/View.php(350): Cake\View\View->loadHelpers()
#11 [ROOT]/vendor/quickapps-plugins/cms/src/View/View.php(82): Cake\View\View->__construct(Object(Cake\Network\Request), Object(Cake\Network\Response), Object(Cake\Event\EventManager), Array)
#12 [ROOT]/vendor/cakephp/cakephp/src/View/ViewBuilder.php(363): CMS\View\View->__construct(Object(Cake\Network\Request), Object(Cake\Network\Response), Object(Cake\Event\EventManager), Array)
#13 [ROOT]/vendor/cakephp/cakephp/src/View/ViewVarsTrait.php(119): Cake\View\ViewBuilder->build(Array, Object(Cake\Network\Request), Object(Cake\Network\Response), Object(Cake\Event\EventManager))
#14 [ROOT]/vendor/cakephp/cakephp/src/Error/ExceptionRenderer.php(356): Cake\Controller\Controller->createView('View')
#15 [ROOT]/vendor/cakephp/cakephp/src/Error/ExceptionRenderer.php(337): Cake\Error\ExceptionRenderer->_outputMessageSafe('error500')
#16 [ROOT]/vendor/cakephp/cakephp/src/Error/ExceptionRenderer.php(194): Cake\Error\ExceptionRenderer->_outputMessage('error500')
#17 [ROOT]/vendor/cakephp/cakephp/src/Error/ErrorHandler.php(144): Cake\Error\ExceptionRenderer->render()
#18 [ROOT]/vendor/cakephp/cakephp/src/Error/BaseErrorHandler.php(180): Cake\Error\ErrorHandler->_displayException(Object(BadMethodCallException))
#19 [ROOT]/vendor/cakephp/cakephp/src/Error/BaseErrorHandler.php(164): Cake\Error\BaseErrorHandler->handleException(Object(BadMethodCallException))
#20 [internal function]: Cake\Error\BaseErrorHandler->wrapAndHandleException(Object(BadMethodCallException))
#21 {main} in [[ROOT]/vendor/cakephp/cakephp/src/Error/ErrorHandler.php, line 156]

2017-09-28 20:46:05 Error: Fatal Error (256): [BadMethodCallException] Method getParam does not exist
#0 [ROOT]/tmp/aop/vendor/cakephp/cakephp/src/View/Helper/FormHelper.php(2561): Cake\Network\Request->__call('getParam', Array)
#1 [ROOT]/tmp/aop/vendor/cakephp/cakephp/src/View/Helper/FormHelper.php(2561): Cake\Network\Request->getParam('_Token')
#2 [ROOT]/tmp/aop/vendor/cakephp/cakephp/src/View/Helper/FormHelper.php(1653): Cake\View\Helper\FormHelper__AopProxied->_initInputField('idPrefix', Array)
#3 [ROOT]/tmp/aop/vendor/cakephp/cakephp/src/View/Helper/FormHelper.php(281): Cake\View\Helper\FormHelper__AopProxied->__call('getConfig', Array)
#4 [ROOT]/tmp/aop/vendor/cakephp/cakephp/src/View/Helper/FormHelper.php(281): CMS\View\Helper\FormHelper->getConfig('idPrefix')
#5 [ROOT]/tmp/ao in [[ROOT]/vendor/cakephp/cakephp/src/Error/ErrorHandler.php, line 156]
botchris commented 6 years ago

Removing the entire AOP's cache-directory does help? (tmp/aop)

nrj4all commented 6 years ago

Very nice ... The deletion helped! Thank you very much!

It seems that everything works as expected. Good job!

aswzen commented 6 years ago

i got the same problem... aop folder already removed but still got the same error

botchris commented 6 years ago

Fixed here: quickapps/website@264d08d