idxbroker / wordpress-plugin

IMPress for IDX Broker
http://www.idxbroker.com
GNU General Public License v2.0
22 stars 30 forks source link

When API error 401 is present, the block editor is broken due to fatal error regarding WP_Error #337

Open LoganStrike opened 3 years ago

LoganStrike commented 3 years ago

Description

When the following error appears on the IMPress Initial Settings page in WP Admin, the WP block editor is also broken, preventing all pages from being edited:

Error 401: Access key is invalid or has been revoked, please ensure there are no spaces in your key. If the problem persists, please reset your API key in the IDX Broker Dashboard, or contact help@idxbroker.com


Notice: Trying to get property 'name' of non-object in /www/wp-content/plugins/idx-broker-platinum/idx/register-blocks.php on line 824

Notice: Trying to get property 'uid' of non-object in /www/wp-content/plugins/idx-broker-platinum/idx/register-blocks.php on line 824

Notice: Trying to get property 'name' of non-object in /www/wp-content/plugins/idx-broker-platinum/idx/register-blocks.php on line 824

Notice: Trying to get property 'uid' of non-object in /www/wp-content/plugins/idx-broker-platinum/idx/register-blocks.php on line 824

Fatal error: Uncaught Error: Cannot use object of type WP_Error as array in /www/wp-content/plugins/idx-broker-platinum/idx/register-blocks.php:752

Stack trace:

0 /www/wp-content/plugins/idx-broker-platinum/idx/register-blocks.php(463): IDX\Register_Blocks->get_agents_select_list()

1 /www/wp-includes/class-wp-hook.php(287): IDX\Register_Blocks->impress_carousel_block_register_script('')

2 /www/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)

3 /www/wp-includes/plugin.php(484): WP_Hook->do_action(Array)

4 /www/wp-admin/edit-form-blocks.php(395): do_action('enqueue_block_e...')

5 /www/wp-admin/post.php(187): require('/www/wp-admin/e...')

6 {main} thrown in /www/wp-content/plugins/idx-broker-platinum/idx/register-blocks.php on line 752

Steps to Reproduce

  1. Requires an invalid or revoked API key. Once the 401 error is displayed in WP admin, try to edit any page with the default block editor.

Versions

WP: 5.6.2 PHP: 7.3 IMPress: 2.6.7

LoganStrike commented 3 years ago

I'm getting a similar error as reported above, although there is no API error in this case and the stack trace is not identical. It looks like it may be related so I'll post it here. Let me know if this needs to be a separate issue instead.

WordPress 5.8.1 Impress 3.0.6

[28-Oct-2021 03:58:43 UTC] PHP Fatal error: Uncaught Error: Cannot use object of type WP_Error as array in /www/wp-content/plugins/idx-broker-platinum/idx/register-blocks.php:803

Stack trace:

0 /www/wp-content/plugins/idx-broker-platinum/idx/register-blocks.php(301): IDX\Register_Blocks->get_agents_select_list()

1 /www/wp-includes/class-wp-hook.php(303): IDX\Register_Blocks->impress_lead_signup_block_register_script('')

2 /www/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters(NULL, Array)

3 /www/wp-includes/plugin.php(470): WP_Hook->do_action(Array)

4 /www/wp-admin/edit-form-blocks.php(252): do_action('enqueue_block_e...')

5 /www/wp-admin/post.php(187): require('/www/wp-admin/e...')

6 {main}

thrown in /www/wp-content/plugins/idx-broker-platinum/idx/register-blocks.php on line 803