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

Getting domdocument::loadHTML(): Argument #1 ($source) must not be empty when button is empty #315

Closed
Skatox opened this issue Nov 25, 2024 · 3 comments
Labels
merged: pending release This has been merged into main but not yet released

Comments

@Skatox
Copy link

Skatox commented Nov 25, 2024

If you do:

  1. Add a regular Gutenberg button without text, like dragging it from the left panel.
  2. Leave the button there and publish a new page.
  3. Query the page with Faust.js and get the Button attributes.

You'll get an internal server error saying that domdocument::loadHTML(): Argument #1 ($source) must not be empty when the button is empty. If you add some text to the button, the problem will disappear.

This is a problem if you rebuild multiple pages and one of them has an information skeleton without any values. It won't work.

@justlevine
Copy link
Contributor

Not sure if it's preexisting or linked via one of our PRs, but I'm pretty sure I've addressed this upstream (assumed the issue was only in the branch) at rtCamp#31

Should have time to backport a fix this week 🤞

@justlevine
Copy link
Contributor

On second look, I'm unable to replicate this using the latest main (v4.3.0)

@Skatox would you be able to confirm what version of plugin you are using and provide a replicable test case?

Here's mine:

Post content:

<!-- wp:buttons -->
<div class="wp-block-buttons"><!-- wp:button -->
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button"></a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->

<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->

Query:

query TestButtons($uri: String!) {
  nodeByUri(uri:$uri){
    ... on NodeWithEditorBlocks {
      editorBlocks{
        __typename
        ... on CoreButtons {
          attributes {
            align
            anchor
            backgroundColor
            borderColor
            className
            cssClassName
            fontFamily
            fontSize
            gradient
            layout
            lock
            metadata
            style
          }
        }
        ... on CoreButton {
          attributes {
            anchor
            backgroundColor
            borderColor
            className
            cssClassName
            fontFamily
            fontSize
            gradient
            placeholder
            linkClassName
            linkTarget
            lock
            metadata
            placeholder
            rel
            style
            tagName
            text
            textAlign
            textColor
            title
            type
            url
            width
          }
        }
      }
    }
  }
}

Results:

image

@josephfusco josephfusco added the merged: pending release This has been merged into main but not yet released label Dec 4, 2024
@theodesp
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged: pending release This has been merged into main but not yet released
Projects
None yet
Development

No branches or pull requests

4 participants