You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After updating to Gutenberg 11.0.0 I noticed a number of Warnings being produced.
I analysed the problem in bobbingwide/thisis#34
and eventually determined that the problem occurs when the block being rendered has produced no output
but has a style attribute for the link color.
For my block this happened because the user was not logged in.
For the scenario to reproduce the problem below it occurs because the block is not registered.
The filter function is still being run against blank output.
This causes the Warnings to be displayed and the invalid output is generated.
Step-by-step reproduction instructions
Add a new post.
Enter Code edit
Paste this content.
<!-- wp:paragraph --><p>Apart from this paragraph the only content in the post is another block with a style attribute. The template only displays the post-content. What could possibly go wrong?</p><!-- /wp:paragraph -->
<!-- wp:reproduce/issue34 {"style":{"elements":{"link":{"color":{"text":"var:preset|color|dark-grey"}}}}} /-->
Save the post.
View the post on the front end. See the unexpected output.
Re edit the post
Change style to smyle
Save and view again
The problem goes away.
Expected behaviour
The block should not appear on the front end.
There shouldn't be any attempt to generate a <style> tag.
Actual behaviour
Warning messages and invalid HTML generated
Warning: Undefined array key 0 in C:\apache\htdocs\wp55\wp-content\plugins\gutenberg\lib\block-supports\elements.php on line 51
Warning: Trying to access array offset on value of type null in C:\apache\htdocs\wp55\wp-content\plugins\gutenberg\lib\block-supports\elements.php on line 51
Warning: Undefined array key 0 in C:\apache\htdocs\wp55\wp-content\plugins\gutenberg\lib\block-supports\elements.php on line 63
Warning: Trying to access array offset on value of type null in C:\apache\htdocs\wp55\wp-content\plugins\gutenberg\lib\block-supports\elements.php on line 63
Apart from this paragraph the only content in the post is another block with a style attribute. The template only displays the post-content. What could possibly go wrong?
class=”wp-elements-60edf9307a0c3″
Description
After updating to Gutenberg 11.0.0 I noticed a number of Warnings being produced.
I analysed the problem in bobbingwide/thisis#34
and eventually determined that the problem occurs when the block being rendered has produced no output
but has a
style
attribute for the link color.Step-by-step reproduction instructions
style
tosmyle
Expected behaviour
The block should not appear on the front end.
There shouldn't be any attempt to generate a
<style>
tag.Actual behaviour
Warning messages and invalid HTML generated
Screenshots or screen recording (optional)
This is what I got:
This is what @annezazu got
Code snippet (optional)
Proposed fix:
Return early when the block content is empty
WordPress information
Device information
For @bobbingwide
The text was updated successfully, but these errors were encountered: