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

DOMDocument::loadHTML() Tag template invalid in Entity PHP Warning #81

Closed
salcode opened this issue Nov 24, 2023 · 0 comments · Fixed by #82
Closed

DOMDocument::loadHTML() Tag template invalid in Entity PHP Warning #81

salcode opened this issue Nov 24, 2023 · 0 comments · Fixed by #82

Comments

@salcode
Copy link
Contributor

salcode commented Nov 24, 2023

When a Gist is retrieve from GitHub and parsed a PHP warning is thrown

DOMDocument::loadHTML() Tag template invalid in Entity

Note: Once the Gist is loaded in the transient, this does not occur again.

Expected Behavior

No warning is thrown, when loading the HTML for the Gist.

Current Behavior

A warning is thrown, when loading the HTML for the Gist.

DOMDocument::loadHTML() Tag template invalid in Entity

Possible Solution

Set

libxml_use_internal_errors(true);

see #80

Steps to Reproduce (for bugs)

  1. Enable PHP warnings
  2. Add a Gist to a post (e.g. https://gist.github.com/salcode/10017553)
  3. Save the post
  4. View the post on the front-end

image

Note: This behavior does NOT occur on page reload, because the output is now stored in a transient. You'll need to delete the transient (prefix gist_html_) to cause the warning again.

salcode added a commit to salcode/gistpress that referenced this issue Nov 24, 2023
Temporarily suspend PHP Warnings on invalid tags when processing Gist
HTML by setting the libxml_use_internal_errors() value to true.

The original value for libxml_use_internal_errors() is restored when the
processing is complete.

props @Dan0sz

See bradyvercher#80

Resolves bradyvercher#81
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant