[wp-trac] [WordPress Trac] #41622: Issue with upgrading text widgets that contain html to 4.8.1
WordPress Trac
noreply at wordpress.org
Sun Aug 13 13:34:52 UTC 2017
#41622: Issue with upgrading text widgets that contain html to 4.8.1
--------------------------+------------------------------
Reporter: codezen8 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Widgets | Version: 4.8.1
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Changes (by codezen8):
* keywords: reporter-feedback =>
Comment:
I am not that familiar with core, but conceptually it would make sense to
trap for any error or warning in the loadHTML function. If there are
issues, return true on is_legacy_instance().
I am able to give you a couple of examples, but note that once you've
updated to 4.8.1, if you revert the files only and not the db to 4.7.5
updating the widgets to try and re-create the issue doesn't reproduce it.
It seems that the widgets had to have been created and saved with files
and db at 4.7.5 or maybe even earlier (some of the ones I have issue with
are much older in terms of last update prior to this)
Example 1 - <footer> tag
PHP Warning: DOMDocument::loadHTML(): Tag footer invalid in Entity, line:
3 in ---\wp-includes\widgets\class-wp-widget-text.php on line 121
widget code: NOTE only causes the issue if Automatically add Paragraphs is
also checked
{{{#!php
<blockquote>I have been a client of Sue's for almost 2 years now. Her
individual care, knowledge of massage therapy and passion for healing has
made me feel cared for and safe. Her work truly makes a difference in my
stressed and crazy life and helps me feel rejuvenated each visit. Thank
you Sue for making a difference and being there for me.
<footer>Sammie C. - Willsboro, ST</footer>
</blockquote>
}}}
force legacy to true, uncheck auto paragraph, go back to 4.8.1 version of
file and it works. I can then also recheck auto paragraph, so it only
seems to fail on initial update when widget is 4.7.5 or earlier db entry
Example 2: when using a shortcode in the widget as part of an html
attribute. Realize this is no longer supported, but this was a much older
implementation
widget code:
{{{#!php
<div class="footer-widget-cta"><h4>It all starts with a
conversation</h4><p>to see if I might be a good fit for your project. If
you are ready to make some changes...</p>
<a class="button alignnone" href="[siteurl]/contact/">Contact Me</a></div>
}}}
removing [siteurl] shortcode to the current site url fixes issue
Example 3: when including a link that has & (or possibly other unescaped
html) AND I think you also must have auto paragraph checked in the widget
widget code:
{{{#!php
<a href="/script.php?foo=bar&hello=world">link doesn't work</a>
<a href="/script.php?foo=bar&hello=world">changing to this link
does</a>
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41622#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list