Describe the bug
I switched from Gutenberg version 8.0.0 to master, and this PHP notice appeared.
The notice appears in:
-It does _not_ appear in the site editor when viewing the single template.
Notice: Trying to get property 'attributes' of non-object in /var/www/html/wp-content/plugins/gutenberg/build/block-library/blocks/post-author.php on line 96
To reproduce
Steps to reproduce the behavior:
Note:
The content/ markup of my single.html file is:
<!-- wp:post-title {"className":"post-title"} /-->
<!-- wp:post-date /-->
<!-- wp:post-author /-->
<!-- wp:post-comments /-->
<!-- wp:post-comments-form /-->
Expected behavior
I expect the post author data to display correctly.
Editor version (please complete the following information):
WordPress version: 5.4.1
Gutenberg: Master, latest commit was: b73bb6d
Desktop (please complete the following information):
Windows 10
Chrome version: 81.0.4044.129
cc @epiqueras @aduth in case this rings any bells. (Maybe block context)
Note that the single.html _does not have a post content block_... I will keep testing
Looks like it's from #19894 (cc @draganescu)
https://github.com/WordPress/gutenberg/pull/19894/files#diff-585397093c781537eba985402a000b3aR96
It's quite likely there was a confusion stemming from the introduction and subsequent removal of a block object as first argument of render_callback (#21467, #21868, #21921). Currently, the first argument of render_callback cannot be referenced as an object in this way.
It's my hope to merge #21925 today, at which point this could be fixed by addressing $block object as the _third_ argument of render_callback.
Fix at #22114
God sticky mobile fingers