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

Uncaught TypeError invoking Site Editor #85

Open
bobbingwide opened this issue Sep 11, 2023 · 1 comment
Open

Uncaught TypeError invoking Site Editor #85

bobbingwide opened this issue Sep 11, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@bobbingwide
Copy link
Owner

bobbingwide commented Sep 11, 2023

On s.b/wordpress I clicked on Appearance > Site Editor and ended up with this Fatal.
Failed in 6.3, also fails in 6.2 and 6.1

Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in C:\apache\htdocs\wordpress\wp-content\themes\fizzie\includes\navigation-link.php:82
Stack trace:

#0 C:\apache\htdocs\wordpress\wp-content\themes\fizzie\includes\navigation-link.php(82): implode(' ', ' menu-item menu...')
#1 C:\apache\htdocs\wordpress\wp-content\themes\fizzie\includes\navigation-link.php(12): fizzie_fiddle_block_context(Array, Object(WP_Block))
#2 C:\apache\htdocs\wordpress\wp-includes\class-wp-block.php(258): fizzie_render_block_core_navigation_link(Array, '', Object(WP_Block))
#3 C:\apache\htdocs\wordpress\wp-includes\blocks.php(1133): WP_Block->render()
#4 C:\apache\htdocs\wordpress\wp-includes\blocks.php(1171): render_block(Array)
#5 C:\apache\htdocs\wordpress\wp-includes\class-wp-hook.php(310): do_blocks('<!-- wp:navigat...')
#6 C:\apache\htdocs\wordpress\wp-includes\plugin.php(205): WP_Hook->apply_filters('<!-- wp:navigat...', Array)
#7 C:\apache\htdocs\wordpress\wp-includes\rest-api\endpoints\class-wp-rest-posts-controller.php(1864): apply_filters('the_content', '<!-- wp:navigat...')
#8 C:\apache\htdocs\wordpress\wp-includes\rest-api\endpoints\class-wp-rest-posts-controller.php(385): WP_REST_Posts_Controller->prepare_item_for_response(Object(WP_Post), Object(WP_REST_Request))
#9 C:\apache\htdocs\wordpress\wp-includes\rest-api\class-wp-rest-server.php(1188): WP_REST_Posts_Controller->get_items(Object(WP_REST_Request))
#10 C:\apache\htdocs\wordpress\wp-includes\rest-api\class-wp-rest-server.php(1035): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wp/v2/navigati...', Array, NULL)
#11 C:\apache\htdocs\wordpress\wp-includes\rest-api.php(545): WP_REST_Server->dispatch(Object(WP_REST_Request))
#12 C:\apache\htdocs\wordpress\wp-includes\rest-api.php(2911): rest_do_request(Object(WP_REST_Request))
#13 [internal function]: rest_preload_api_request(Array, '/wp/v2/navigati...')
#14 C:\apache\htdocs\wordpress\wp-includes\block-editor.php(743): array_reduce(Array, 'rest_preload_ap...', Array)
#15 C:\apache\htdocs\wordpress\wp-admin\site-editor.php(116): block_editor_rest_api_preload(Array, Object(WP_Block_Editor_Context))
#16 {main}
  thrown in <b>C:\apache\htdocs\wordpress\wp-content\themes\fizzie\includes\navigation-link.php</b> on line <b>82</b><br />

Additionally, the trace log shows a couple of Warnings from the code that's sending the fatal error email.

C:\apache\htdocs\wordpress\wp-content\plugins\oik-bwtrace\includes\bwtrace-actions.php(286:2) bw_trace_error_handler(1) 1394 1 2023-09-11T10:46:40+00:00 2.839904 0.065048 cf=the_content 73246 137 18395 27262976/27262976 1024M F=1682 err Array

    [0] => (integer) 2
    [1] => (string) "Warning: Trying to access array offset on value of type bool"
    [2] => (string) "C:\apache\htdocs\wordpress\wp-includes\class-wp-recovery-mode-email-service.php"
    [3] => (integer) 367

C:\apache\htdocs\wordpress\wp-content\plugins\oik-bwtrace\includes\bwtrace-actions.php(287:64) bw_trace_error_handler(2) 1395 1 2023-09-11T10:46:40+00:00 2.840061 0.000157 cf=the_content 73246 137 18395 27262976/27262976 1024M F=1682 errcontext 
0. bw_lazy_backtrace C:\apache\htdocs\wordpress\wp-content\plugins\oik-bwtrace\libs\bwtrace.php:108 0
1. bw_backtrace C:\apache\htdocs\wordpress\wp-content\plugins\oik-bwtrace\includes\bwtrace-actions.php:293 0
2. bw_trace_error_handler(2,Trying to access array offset on value of type bool,C:\apache\htdocs\wordpress\wp-includes\class-wp-recovery-mode-email-service.php,367) C:\apache\htdocs\wordpress\wp-includes\class-wp-recovery-mode-email-service.php:367 4
3. get_debug(array) C:\apache\htdocs\wordpress\wp-includes\class-wp-recovery-mode-email-service.php:150 1
4. send_recovery_mode_email(86400,array,array) C:\apache\htdocs\wordpress\wp-includes\class-wp-recovery-mode-email-service.php:62 3
5. maybe_send_recovery_mode_email(86400,array,array) C:\apache\htdocs\wordpress\wp-includes\class-wp-recovery-mode.php:185 3
6. handle_error(array) C:\apache\htdocs\wordpress\wp-includes\class-wp-fatal-error-handler.php:53 1
7. handle C:\apache\htdocs\wordpress\wp-includes\class-wp-fatal-error-handler.php:0 0
@bobbingwide bobbingwide added the bug Something isn't working label Sep 11, 2023
@bobbingwide bobbingwide self-assigned this Sep 11, 2023
@bobbingwide
Copy link
Owner Author

The code was failing since $attributes['className'] was already a string, so did not need to be imploded.

[className] => (string) " menu-item menu-item-type-post_type menu-item-object-page"

Simplest solution was to check if it was an array before calling implode. If not, then assign the string directly.
This fixes the fatal.

I didn't check if the code was still necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant