{"id":19001647,"date":"2026-08-24T16:50:50","date_gmt":"2026-08-24T16:50:50","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/flying-scripts-bundles-simple_html_dom-conflicts-with-webp-express\/"},"modified":"2026-08-24T16:50:50","modified_gmt":"2026-08-24T16:50:50","slug":"flying-scripts-bundles-simple_html_dom-conflicts-with-webp-express","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/flying-scripts-bundles-simple_html_dom-conflicts-with-webp-express\/","title":{"rendered":"Flying Scripts bundles simple_html_dom &#8211; conflicts with WebP Express"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hello,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I&#8217;m running Flying Scripts on a WordPress site (shared hosting, PHP 8.x)<br \/>together with the WebP Express plugin. Since installing both, the site&#8217;s<br \/>php-errors.log is flooded with warnings on every single page load:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>PHP Warning:  Constant HDOM_TYPE_ELEMENT already defined in\n...\/webp-express\/vendor\/kub-at\/php-simple-html-dom-parser\/src\/KubAT\/PhpSimple\/lib\/simple_html_dom.php on line 26<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The same warning repeats for every HDOM_* constant (HDOM_TYPE_<em>, HDOM_QUOTE_<\/em>,<br \/>HDOM_INFO_*, etc.), so each request writes roughly 30+ lines. Over the past year<br \/>the log grew to ~86 GB (about 218 million warning lines) and is filling the disk<br \/>on our shared hosting.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Root cause: Flying Scripts bundles its own copy of the simple_html_dom parser<br \/>(v1.9.1) in:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...\/public_html\/wp-content\/plugins\/flying-scripts\/lib\/dom-parser.php<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It&#8217;s wrapped in if(!class_exists(&#8216;simple_html_dom&#8217;)), which protects the class,<br \/>but the global HDOM_* constants at the top of that block are declared with<br \/>unguarded define() calls. WebP Express bundles a second copy of the same parser,<br \/>so whichever plugin loads second re-declares the constants and PHP logs the<br \/>&#8220;already defined&#8221; warning. In our case the warnings point to WebP Express&#8217;s copy,<br \/>but the fix can be done on either side \u2014 guarding your defines would resolve it<br \/>too, since your copy is loaded first.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Suggested fix: guard the define() calls in lib\/dom-parser.php, e.g.:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if (!defined('HDOM_TYPE_ELEMENT')) {\n    define('HDOM_TYPE_ELEMENT', 1);\n    \/\/ ...\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">or move the constants into a namespace\/class. For comparison, WP Optimize bundles<br \/>a namespaced (modern) copy of simplehtmldom and never touches global names, so it<br \/>causes no conflicts.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Any chance the bundled parser could be updated\/patched? This would help a lot of<br \/>users on shared hosting with limited disk space.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Environment:<\/p>\n\n\n\n<ul>\n<li>WordPress 6.x, Flying Scripts (latest), WebP Express (latest)<\/li>\n\n\n\n<li>Shared hosting (CloudWays), PHP 8.x<\/li>\n\n\n\n<li>php-errors.log written via error_log ini setting in wp-config.php<\/li>\n<\/ul>\n","protected":false},"template":"","class_list":["post-19001647","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19001647","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19001647\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=19001647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}