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

PHP notice when adding a Post author block #22100

Closed
carolinan opened this issue May 5, 2020 · 5 comments · Fixed by #22114
Closed

PHP notice when adding a Post author block #22100

carolinan opened this issue May 5, 2020 · 5 comments · Fixed by #22114
Assignees
Labels
[Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@carolinan
Copy link
Contributor

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

@youknowriad youknowriad added [Feature] Full Site Editing Needs Testing Needs further testing to be confirmed. labels May 5, 2020
@youknowriad
Copy link
Contributor

cc @epiqueras @aduth in case this rings any bells. (Maybe block context)

@carolinan
Copy link
Contributor Author

Note that the single.html does not have a post content block... I will keep testing

@aduth
Copy link
Member

aduth commented May 5, 2020

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.

@aduth aduth added [Type] Bug An existing feature does not function as intended and removed Needs Testing Needs further testing to be confirmed. labels May 5, 2020
@aduth aduth self-assigned this May 5, 2020
@aduth
Copy link
Member

aduth commented May 5, 2020

Fix at #22114

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label May 5, 2020
@carolinan
Copy link
Contributor Author

God sticky mobile fingers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants