reduxframework / redux-framework-4

Redux v4
https://redux.io/redux-4/
Other
97 stars 32 forks source link

Fatal error on activation #224

Closed mohammedeisa closed 3 years ago

mohammedeisa commented 3 years ago

Issue description:

I got the following error when I tried to activate Redux: Fatal error: Uncaught TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given in E:\wamp\www\redux_training\wp-content\plugins\redux-framework\redux-templates\classes\class-templates.php:82 Stack trace: #0 E:\wamp\www\redux_training\wp-content\plugins\redux-framework\redux-templates\classes\class-templates.php(82): method_exists(NULL, 'is_block_editor') #1 E:\wamp\www\redux_training\wp-content\plugins\redux-framework\redux-templates\classes\class-templates.php(43): ReduxTemplates\Templates->is_gutenberg_page() #2 E:\wamp\www\redux_training\wp-content\plugins\redux-framework\redux-templates\classes\class-init.php(59): ReduxTemplates\Templates->__construct() #3 E:\wamp\www\redux_training\wp-includes\class-wp-hook.php(292): ReduxTemplates\Init::load('') #4 E:\wamp\www\redux_training\wp-includes\class-wp-hook.php(316): WP_Hook->apply_filters(NULL, Array) #5 E:\wamp\www\redux_training\wp-includes\plugin.php(484): WP_Hook->do_action(Array) #6 E:\wamp\www\redux_training\wp-settings.php(560): do_action('init') #7 E:\wamp\www\redux_training\wp-config.php(101): require_once('E:\wamp\www\red...') #8 E:\wamp\www\redux_training\wp-load.php(37): require_once('E:\wamp\www\red...') #9 E:\wamp\www\redux_training\wp-admin\admin.php(34): require_once('E:\wamp\www\red...') #10 E:\wamp\www\redux_training\wp-admin\plugins.php(10): require_once('E:\wamp\www\red...') #11 {main} thrown in E:\wamp\www\redux_training\wp-content\plugins\redux-framework\redux-templates\classes\class-templates.php on line 82

mohammedeisa commented 3 years ago

Replacing line 82 in \redux-framework\redux-templates\classes\class-templates.php with the following line fixed the issue for me: if (isset($current_screen) && method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() ) {

kprovance commented 3 years ago

Yeah, that solves for the error, but doesn't explain why get_current_screen fails. Lemme look into it. worst case, we stick this solution in there to prevent the fatal.

kprovance commented 3 years ago

Okay, that should do it.