[wp-trac] [WordPress Trac] #41622: Issue with upgrading text widgets that contain html to 4.8.1

WordPress Trac noreply at wordpress.org
Sat Aug 12 23:19:17 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        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Have a number of sites that use html in widgets, so waited to upgrade from
 4.7.5 to 4.8.1  - a few of the sites would not load /wp-admin/widgets.php
 after upgrading

 error occurred in the function that evaluates whether this widget should
 use legacy text mode or the visual editor.

 errors like:

 PHP Warning:  DOMDocument::loadHTML(): Tag footer invalid in Entity, line:
 3 in ---\wp-includes\widgets\class-wp-widget-text.php on line 121

 PHP Warning:  DOMDocument::loadHTML(): Tag lorem invalid in Entity, line:
 3 in --- \wp-includes\widgets\class-wp-widget-text.php on line 121

 PHP Warning:  DOMDocument::loadHTML(): Unexpected end tag : div in Entity,
 line: 6 in --- \wp-includes\widgets\class-wp-widget-text.php on line 121

 I temporarily changed the function is_legacy_instance( $instance ) in that
 file to always return true.  The widget page opens with all widgets in
 legacy more; I found some test widgets (haven't updated any production
 sites yet) that had html5 elements (<footer>), text that looks something
 like tags (<lorem ipsum), and invalid html (a widget with a <h2>some
 text</h3>).

 Updating these widgets to remove/fix these items and replacing the
 original file, everything works fine.

 I've also found instances where client added html that was not clean, but
 worked as old text widget. In 4.8.1 parts of that code and the text in the
 tag (tag that doesn't have end tag for example) disappear in the visual
 editor and the text view in the new widget. reverting the site back to
 4.7.5 shows that the original values are still in the database.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41622>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list