Fatal error saving table – DOMDocument ValueError on PHP 8
-
Hi WP Table Builder Team,
We’re encountering a fatal error when saving a table on our WordPress site (smartfindsmarketing.com). The issue occurs via
admin-ajax.phpwhen performing a “Save Table” action.Below is the relevant error excerpt from our
debug.logfile:PHP Fatal error: Uncaught ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty in /wp-content/plugins/wp-table-builder/vendor/rhukster/dom-sanitizer/src/DOMSanitizer.php:326 Stack trace: #0 /wp-content/plugins/wp-table-builder/vendor/rhukster/dom-sanitizer/src/DOMSanitizer.php(326): DOMDocument->loadHTML('') #1 /wp-content/plugins/wp-table-builder/inc/Shortcode_Element.php(147): DOMSanitizer->sanitize('') #2 /wp-content/plugins/wp-table-builder/inc/TableRenderer.php(234): Shortcode_Element->render() #3 /wp-content/plugins/wp-table-builder/inc/Admin_Menu.php(429): TableRenderer->render_cell() #4 /wp-includes/class-wp-hook.php(308): Admin_Menu->save_table() #5 /wp-admin/admin-ajax.php(203): do_action('wp_ajax_save_table')What we’ve already checked:
- Running PHP 8.0.
- Confirmed no database errors.
- The error triggers when a table includes a shortcode or possibly an empty cell.
- Other unrelated plugin warnings (“Add Search to Menu”) are present but not the root cause.
Hypothesis:
It appears the plugin’s DOM sanitizer attempts to callDOMDocument::loadHTML()on an empty string, which PHP 8+ now treats as aValueError. This may need a guard to skip empty input before sanitization.Questions:
- Can you confirm if this is a known issue with WP Table Builder on PHP 8.x?
- Is there a patch or temporary fix (e.g., conditional check) to prevent this error until an update is released?
- Would you like me to provide a sample table export or exact steps to reproduce it?
Thank you for your time and for maintaining a great plugin!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.