Skip Navigation

[Resolved] toolset maps gives fatal error

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

This topic contains 6 replies, has 2 voices.

Last updated by Mateus Getulio 1 year, 11 months ago.

Assisted by: Mateus Getulio.

Author
Posts
#2569211

I use Beaver Builder on my site. When I try to edit my page on the front-end it gives me a fatal error with this message:

"Fatal error: Uncaught TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given in /home/deb106556/domains/mydomain.nl/public_html/wp-content/plugins/toolset-maps/includes/toolset-maps-views.class.php:298

Stack trace:
#0 /home/deb106556/domains/mydomain.nl/public_html/wp-content/plugins/toolset-maps/includes/toolset-maps-views.class.php(298): method_exists()

#1 /home/deb106556/domains/mydomain.nl/public_html/wp-content/plugins/toolset-maps/includes/toolset-maps-views.class.php(281): Toolset_Addon_Maps_Views->is_block_editor() "

When I disable Toolset Maps I can use the BeaverBuilder plugin.

#2569587

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi there,

Thanks for your contact and welcome to the Toolset support forum!

We might be facing an interaction issue with a third-party functionality, in this case:

- Deactivate all the plugins that are not related to Toolset
- Switch for a moment to a WordPress default theme like Twenty Twenty-one
- If the issue is gone, activate one by one to see with which one there is an interaction issue

Could you please tell me the results of this investigation? Also, can you enable the debug mode? Just add the following code in your wp-config.php file:

// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );
  
// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );
  
// Disable display of errors and warnings 
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
  
// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define( 'SCRIPT_DEBUG', true );

Please check the following links to read more about debugging with WordPress.
- https://codex.wordpress.org/Debugging_in_WordPress
- https://codex.wordpress.org/Debugging_in_WordPress#Example_wp-config.php_for_Debugging

After adding the code above, try to reproduce the issue again and check if you'll find a debug.log file inside the wp-content folder. If you locate it there, kindly send us the last lines here in the ticket.

Regards,
Mateus.

#2572161

I had a look at your code where the TypeError is thrown:

private function is_block_editor() {
	if ( function_exists( 'get_current_screen' ) ) {
		$current_screen = get_current_screen();
		return ( method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() );
	}
	return false;
}

Looking at the return type of get_curent_screen:

 * @return WP_Screen|null Current screen object or null when screen not defined.
  • if $current_Screen is WP_Screen object, the method_exists() call will always return true as a WP_Screen object will always contain the method is_block_editor().
  • if $current_Screen is null, the method_exists() call will fail.

So imho, the logic should rather be:

return $current_screen instanceof WP_Screen && $current_screen->is_block_editor();
#2572301

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

I would like to request temporary access (wp-admin and FTP) to your site to take better look at the issue. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Our Debugging Procedures

I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site.

Privacy and Security Policy

We have strict policies regarding privacy and access to your information. Please see:
https://toolset.com/privacy-policy-and-gdpr-compliance/#data-shared-with-our-support
**IMPORTANT**

- Please make a backup of site files and database before providing us access.
- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this: hidden link

Please, let me know if you need any additional details. Have a nice day.

#2572625

Please, you don't need to bother to log in. As explained above, the code that guards against get_current_screen() not returning a WP_Screen does not work anymore with PHP 8.0, because as of that version the 1st argument is strong typed to be object|string, so null is no longer accepted. So better check for the type of $current_screen: null or a WP_Screen object instead of calling method_exists().

#2572965

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi there,

Thank you for the updates.

I have escalated this ticket to our 2nd tier of support where our 2nd tier specialists will take a deeper look at this issue and will try to find a solution.

I will get back to you as soon as I get an answer from them. Thanks!

Best regards,
Mateus

#2574509

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hey there,

Thanks for your patience.

The bug has been already reported to our dev team, and most probably it'll be fixed in the next Toolset Maps version. Please stay tuned for it, and in the meantime you can keep using your workaround.

Best regards,
Mateus.