Gutenberg: PHP notice when adding a Post author block

Created on 5 May 2020  路  5Comments  路  Source: WordPress/gutenberg

Describe the bug
I switched from Gutenberg version 8.0.0 to master, and this PHP notice appeared.

The notice appears in:

  • The standard block editor when a post author block is added.
  • On the front when viewing a single.html full site editing template.

-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:

  1. Enable full site editing
  2. Create a new post
  3. Add a post author block and save
  4. See error

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

[Feature] Full Site Editing [Status] In Progress [Type] Bug

All 5 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

franz-josef-kaiser picture franz-josef-kaiser  路  3Comments

jasmussen picture jasmussen  路  3Comments

nylen picture nylen  路  3Comments

ellatrix picture ellatrix  路  3Comments

mhenrylucero picture mhenrylucero  路  3Comments