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 Type Error: array_key_exists(): Argument #2 ($array) must be of type array, null given #62

Closed
bobbingwide opened this issue Apr 12, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@bobbingwide
Copy link
Owner

While trying to implement a custom page template that supports the display of a full width image, I played around with adding "layout": {"inherit":true} to the post title block, inside a group block that had "align": "full".
The intention was to have the post title with normal alignment.

This was in the template part post-content.html being called from the template single-full.html.

<!-- wp:template-part {"slug":"post-content","theme":"fizzie", "className": "post-content", "align":"full","layout":{"inherit":true} } /-->

post-content.html was:

<!-- wp:group {"className":"post","backgroundColor":"background","align":"full"} -->
<div class="wp-block-group post has-background-background-color has-background alignfull">
    <!-- wp:post-title { "layout":{"inherit":true} }/-->

<!-- wp:post-content /-->

<!-- wp:post-tags /-->

<!-- wp:post-hierarchical-terms {"term":"category"} /--></div>
<!-- /wp:group -->

All of the above was created by hand, not using the Site Editor nor the block editor for Templates or Template Parts.
Gutenberg 10.3.1

I was surprised to see the Fatal error:

Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in C:\apache\htdocs\wordpress\wp-content\plugins\gutenberg\lib\block-supports\align.php:48 
Stack trace: 
#0 C:\apache\htdocs\wp-a2z\wp-includes\class-wp-block-supports.php(113): gutenberg_apply_alignment_support(Object(WP_Block_Type), NULL) 
#1 C:\apache\htdocs\wp-a2z\wp-includes\class-wp-block-supports.php(171): WP_Block_Supports->apply_block_supports() 
#2 C:\apache\htdocs\wordpress\wp-content\plugins\gutenberg\build\block-library\blocks\post-title.php(34): get_block_wrapper_attributes(Array) 
#3 C:\apache\htdocs\wordpress\wp-content\plugins\gutenberg\lib\compat.php(136): gutenberg_render_block_core_post_title(Array, '', Object(WP_Block)) 
#4 C:\apache\htdocs\wp-a2z\wp-includes\class-wp-block.php(221): {closure}(Array, '', Object(WP_Block)) 
#5 C:\apache\htdocs\wp-a2z\wp-includes\class-wp-block.php(211): WP_Block->render() 
#6 C:\apache\htdocs\wp-a2z\wp-includes\blocks.php(799): WP_Block->render() 
#7 C:\apache\htdocs\wp-a2z\wp-includes\blocks.php(837): render_block(Array) 
#8 C:\apache\htdocs\wordpress\wp-content\plugins\gutenberg\build\block-library\blocks\template-part.php(100): do_blocks('<!-- wp:group {...') 
#9 C:\apache\htdocs\wordpress\wp-content\plugins\gutenberg\lib\compat.php(136): gutenberg_render_block_core_template_part(Array, '', Object(WP_Block)) 
#10 C:\apache\htdocs\wp-a2z\wp-includes\class-wp-block.php(221): {closure}(Array, '', Object(WP_Block)) 
#11 C:\apache\htdocs\wp-a2z\wp-includes\blocks.php(799): WP_Block->render() 
#12 C:\apache\htdocs\wp-a2z\wp-includes\blocks.php(837): render_block(Array) 
#13 C:\apache\htdocs\wordpress\wp-content\plugins\gutenberg\lib\full-site-editing\template-loader.php(192): do_blocks('<!-- wp:html --...') 
#14 C:\apache\htdocs\wordpress\wp-content\plugins\gutenberg\lib\template-canvas.php(12): gutenberg_get_the_template_html() 
#15 C:\apache\htdocs\wp-a2z\wp-includes\template-loader.php(106): include('C:\\apache\\htdoc...') 
#16 C:\apache\htdocs\wp-a2z\wp-blog-header.php(19): require_once('C:\\apache\\htdoc...') 
#17 C:\apache\htdocs\wp-a2z\index.php(17): require('C:\\apache\\htdoc...') 
#18 {main} thrown in C:\apache\htdocs\wordpress\wp-content\plugins\gutenberg\lib\block-supports\align.php on line 48
@bobbingwide bobbingwide added the bug Something isn't working label Apr 12, 2021
@bobbingwide bobbingwide self-assigned this Apr 12, 2021
@bobbingwide
Copy link
Owner Author

bobbingwide commented Apr 12, 2021

I found other combinations of attributes that cause the Fatal Error. eg {"fred":{""} }.
I didn't investigate further than to confirm what the stack trace already told me
that NULL was being passed as the second parameter to gutenberg_apply_alignment_support().

@bobbingwide
Copy link
Owner Author

Looks like this was fixed for #82

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