Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to function isAdmin() on null in .../cms/config/functions.php on line 410 #179

Closed
paulrwest opened this issue Aug 10, 2017 · 5 comments

Comments

@paulrwest
Copy link

Running on Docker on PHP7

After composer update the entire CMS is broken due to the following:

2017-08-10 09:32:41 Error: Fatal Error (1): Uncaught Error: Call to a member function isAdmin() on null in /var/www/site/vendor/quickapps-plugins/cms/config/functions.php:410
Stack trace:
#0 /var/www/site/vendor/quickapps-plugins/cms/src/Error/ExceptionRenderer.php(32): theme()
#1 /var/www/site/vendor/cakephp/cakephp/src/Error/ErrorHandler.php(136): CMS\Error\ExceptionRenderer->__construct(Object(Cake\Error\PHP7ErrorException))
#2 /var/www/site/vendor/cakephp/cakephp/src/Error/BaseErrorHandler.php(187): Cake\Error\ErrorHandler->_displayException(Object(Cake\Error\PHP7ErrorException))
#3 /var/www/site/vendor/cakephp/cakephp/src/Error/BaseErrorHandler.php(171): Cake\Error\BaseErrorHandler->handleException(Object(Cake\Error\PHP7ErrorException))
#4 [internal function]: Cake\Error\BaseErrorHandler->wrapAndHandleException(Object(Cake\Error\PHP7ErrorException))
#5 {main}
thrown in [/var/www/site/vendor/quickapps-plugins/cms/config/functions.php, line 410]
Trace:
Cake\Error\BaseErrorHandler::handleFatalError() - CORE/src/Error/BaseErrorHandler.php, line 223
Cake\Error\BaseErrorHandler::Cake\Error{closure}() - CORE/src/Error/BaseErrorHandler.php, line 104
[main] - [internal], line ??

functions.php:410:

$option = Router::getRequest()->isAdmin() ? 'back_theme' : 'front_theme';

Router::getRequest is returning null.

debugging Cake/Router shows static::$_requests as an empty array.

Composer file:

"name": "quickapps/website",
"description": "QuickAppsCMS website app skeleton",
"homepage": "http://quickappscms.org",
"type": "project",
"license": "GPL-3.0",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=5.6",
"cakephp/cakephp": "~3.3",
"mobiledetect/mobiledetectlib": "2.",
"cakephp/plugin-installer": "
",
"quickapps-plugins/installer": "*",
"developerforce/force.com-toolkit-for-php": "^27.0",
"simplesamlphp/simplesamlphp": "^1.14",
"cakephp/debug_kit": "^3.4",
"cakephp/bake": "~1.1",
"aws/aws-sdk-php": "^3.22"
},

@botchris
Copy link
Collaborator

botchris commented Aug 10, 2017

  • CakePHP version? (see composer.lock)

  • Does it fails when trying to access both front & backend ?

  • Did you tried removing the file TMP/snapshot.php ?

  • As provisional fix you can alter the line 410:

$option = Router::getRequest() && Router::getRequest()->isAdmin() ? 'back_theme' : 'front_theme';

@paulrwest
Copy link
Author

"name": "cakephp/cakephp",
"version": "3.4.12",

I tried that and was then erroring about theme being ""

@botchris
Copy link
Collaborator

Your CakePHP version seems to be wrong, it should be something "3.3.x".
Try forcing it to 3.3.11

"cakephp/cakephp": "3.3.11"

@paulrwest
Copy link
Author

Yeah I'm just looking into why it's on 3.4

Clearing cache and snapshot has helped sorry should have tried that earlier. I've added the check for Request which I had tried earlier but was showing other errors but it's now not erroring on CMS code.

let me try forcing it to 3.3

@botchris
Copy link
Collaborator

botchris commented Apr 5, 2018

Fixed here: quickapps/website@264d08d

@botchris botchris closed this as completed Apr 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants