Title: PHP Warning
Last modified: July 3, 2021

---

# PHP Warning

 *  Resolved [Nick Diego](https://wordpress.org/support/users/ndiego/)
 * (@ndiego)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/php-warning-295/)
 * Hi there,
 * First off, awesome plugin. One of the few that works in the new Site Editor when
   placed outside of the main post content loop.
 * I did run into a strange PHP warning. I did a bit of investigation and cannot
   seem to figure out why it is occurring.
 * `Warning: DOMDocument::loadHTML(): Empty string supplied as input in .../wp-content/
   plugins/simpletoc/plugin.php on line 221`
 * However, looking at the code on line 221, you could add a failsafe that would
   resolve this situation if it ever came up. Something like:
 *     ```
       function addAnchorAttribute($html){
   
         	// remove non-breaking space entites from input HTML
         	$html_wo_nbs = str_replace("&nbsp;", " ", $html);
   
       	if ( ! $html_wo_nbs ) {
       		return $html;
       	}
   
       	...
       ```
   
 * Anyway, just thought I would share. I have manually added the code above and 
   everything works as expected. Thanks again for the plugin.
 * Best,
    Nick

Viewing 12 replies - 1 through 12 (of 12 total)

 *  Plugin Author [Marc Tönsing](https://wordpress.org/support/users/marcdk/)
 * (@marcdk)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/php-warning-295/#post-14622959)
 * Thank you! Fixed in 4.7
 *  [igrowtea](https://wordpress.org/support/users/igrowtea/)
 * (@igrowtea)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/php-warning-295/#post-15012298)
 * Hi Marc,
    I’m seeing this same PHP warning in 4.8 but just on one page of the
   site. Deactivation of the plugin of course removes the warning.
 * Any suggestions?
 * Thanks!
 *  Plugin Author [Marc Tönsing](https://wordpress.org/support/users/marcdk/)
 * (@marcdk)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/php-warning-295/#post-15012323)
 * The exact same error? I will look into it
 *  [igrowtea](https://wordpress.org/support/users/igrowtea/)
 * (@igrowtea)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/php-warning-295/#post-15012412)
 * Well, it’s not exactly the same, but it’s close.
 * Warning: DOMDocument::loadHTML(): Tag mark invalid in Entity, line: 2 in …/wp-
   content/plugins/simpletoc/plugin.php on line 226
 * Page with warning here:
    [https://leafhousetea.com/caffeine-free-naturally-sweet-rooibos-honeybush-tea-help-you-kick-bad-habits/](https://leafhousetea.com/caffeine-free-naturally-sweet-rooibos-honeybush-tea-help-you-kick-bad-habits/)
 *  Plugin Author [Marc Tönsing](https://wordpress.org/support/users/marcdk/)
 * (@marcdk)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/php-warning-295/#post-15015052)
 * You use invalid html tags in your content:
 * `<mark class=kt-highlight>bush teas</mark></strong>`
 * I will prevent messages like this to appear in the future. But this error happens
   because your HTML contains invalid tags
 *  Plugin Author [Marc Tönsing](https://wordpress.org/support/users/marcdk/)
 * (@marcdk)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/php-warning-295/#post-15015070)
 * Can you please check if you copy this [https://raw.githubusercontent.com/mtoensing/simpletoc/master/plugin.php](https://raw.githubusercontent.com/mtoensing/simpletoc/master/plugin.php)
   to the plugin.php in your SimpleTOC plugin folder in /wp-content/plugins/simpletoc/
   if the error is gone?
 *  [igrowtea](https://wordpress.org/support/users/igrowtea/)
 * (@igrowtea)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/php-warning-295/#post-15015449)
 * Copied your update to the plugin folder but the error message is still showing
   in Chrome incognito and private Safari. However, SimpleTOC works as it should.
 *  Plugin Author [Marc Tönsing](https://wordpress.org/support/users/marcdk/)
 * (@marcdk)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/php-warning-295/#post-15015477)
 * Thank you for testing. Please try again:
 * [https://raw.githubusercontent.com/mtoensing/simpletoc/master/plugin.php](https://raw.githubusercontent.com/mtoensing/simpletoc/master/plugin.php)
 * The change is in line 227 [https://github.com/mtoensing/simpletoc/blob/master/plugin.php#L227](https://github.com/mtoensing/simpletoc/blob/master/plugin.php#L227)
 *  [igrowtea](https://wordpress.org/support/users/igrowtea/)
 * (@igrowtea)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/php-warning-295/#post-15015517)
 * Sorry, Marc, but the message is still there.
 * I appreciate that you’re trying! Thank you.
 *  [igrowtea](https://wordpress.org/support/users/igrowtea/)
 * (@igrowtea)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/php-warning-295/#post-15015658)
 * I’ve also deleted the invalid html and yet the warning still appears. Hm.
 *  Plugin Author [Marc Tönsing](https://wordpress.org/support/users/marcdk/)
 * (@marcdk)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/php-warning-295/#post-15015866)
 * I don’t see the message anymore on your link
 *  [igrowtea](https://wordpress.org/support/users/igrowtea/)
 * (@igrowtea)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/php-warning-295/#post-15015945)
 * I see that now but since I’ve deleted the bad HTML we won’t know if your PHP 
   update was effective.
 * Thank you in any case!

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘PHP Warning’ is closed to new replies.

 * ![](https://ps.w.org/simpletoc/assets/icon.svg?rev=2796116)
 * [SimpleTOC - Table of Contents Block](https://wordpress.org/plugins/simpletoc/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simpletoc/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simpletoc/)
 * [Active Topics](https://wordpress.org/support/plugin/simpletoc/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simpletoc/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simpletoc/reviews/)

 * 12 replies
 * 3 participants
 * Last reply from: [igrowtea](https://wordpress.org/support/users/igrowtea/)
 * Last activity: [4 years, 7 months ago](https://wordpress.org/support/topic/php-warning-295/#post-15015945)
 * Status: resolved