webp-express icon indicating copy to clipboard operation
webp-express copied to clipboard

PHP notices (simple_html_dom)

Open ObviousInvestor opened this issue 3 years ago • 14 comments

Hi,

Constantly getting the errors below. Everything seems to be working ok but just wondering what's causing this?

Notice Constant HDOM_TYPE_ELEMENT already defined 1 +wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src-vendor/simple_html_dom/simple_html_dom.inc:64 Plugin: webp-express
Notice Constant HDOM_TYPE_COMMENT already defined 1 +wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src-vendor/simple_html_dom/simple_html_dom.inc:65 Plugin: webp-express
Notice Constant HDOM_TYPE_TEXT already defined 1 +wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src-vendor/simple_html_dom/simple_html_dom.inc:66 Plugin: webp-express
Notice Constant HDOM_TYPE_ENDTAG already defined 1 +wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src-vendor/simple_html_dom/simple_html_dom.inc:67 Plugin: webp-express
Notice Constant HDOM_TYPE_ROOT already defined 1 +wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src-vendor/simple_html_dom/simple_html_dom.inc:68 Plugin: webp-express
Notice Constant HDOM_TYPE_UNKNOWN already defined 1 +wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src-vendor/simple_html_dom/simple_html_dom.inc:69 Plugin: webp-express
Notice Constant HDOM_QUOTE_DOUBLE already defined 1 +wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src-vendor/simple_html_dom/simple_html_dom.inc:70 Plugin: webp-express
Notice Constant HDOM_QUOTE_SINGLE already defined 1 +wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src-vendor/simple_html_dom/simple_html_dom.inc:71 Plugin: webp-express
Notice Constant HDOM_QUOTE_NO already defined 1 +wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src-vendor/simple_html_dom/simple_html_dom.inc:72 Plugin: webp-express
Notice Constant HDOM_INFO_BEGIN already defined 1 +wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src-vendor/simple_html_dom/simple_html_dom.inc:73 Plugin: webp-express
Notice Constant HDOM_INFO_END already defined 1 +wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src-vendor/simple_html_dom/simple_html_dom.inc:74 Plugin: webp-express
Notice Constant HDOM_INFO_QUOTE already defined 1 +wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src-vendor/simple_html_dom/simple_html_dom.inc:75 Plugin: webp-express
Notice Constant HDOM_INFO_SPACE already defined 1 +wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src-vendor/simple_html_dom/simple_html_dom.inc:76 Plugin: webp-express
Notice Constant HDOM_INFO_TEXT already defined 1 +wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src-vendor/simple_html_dom/simple_html_dom.inc:77 Plugin: webp-express
Notice Constant HDOM_INFO_INNER already defined 1 +wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src-vendor/simple_html_dom/simple_html_dom.inc:78 Plugin: webp-express
Notice Constant HDOM_INFO_OUTER already defined 1 +wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src-vendor/simple_html_dom/simple_html_dom.inc:79 Plugin: webp-express
Notice Constant HDOM_INFO_ENDSPACE already defined 1 +wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src-vendor/simple_html_dom/simple_html_dom.inc:80 Plugin: webp-express
Notice Constant HDOM_SMARTY_AS_TEXT already defined 1 +wp-content/plugins/webp-express/vendor/rosell-dk/dom-util-for-webp/src-vendor/simple_html_dom/simple_html_dom.inc:95 Plugin: webp-express

ObviousInvestor avatar Nov 09 '21 11:11 ObviousInvestor

WebP Express uses that code for Alter HTML. It would seem that simple_html_dom.inc gets included twice. It is however surprising, as it does make a test if it is included before doing the including:

            if (!function_exists('str_get_html')) {
                require_once __DIR__ . '/../src-vendor/simple_html_dom/simple_html_dom.inc';
            }

Perhaps some other plugin uses a library which defines constants with the same names as simple_html_dom.

Which option have you btw selected in Alter HTML? "Replace img-tags with picture tags" or "Replace image URLs" ? In 0.22.0, I made a change to "Replace img-tags with picture tags" so it only includes simple_html_dom when DOMDocument is unavailable.

rosell-dk avatar Nov 09 '21 12:11 rosell-dk

Do you have file search on your server? In that case, it could be interesting to search for "HDOM_TYPE_COMMENT" to see if other code on your site defines that. On linux: grep -r 'HDOM_TYPE_COMMENT' .

rosell-dk avatar Nov 09 '21 12:11 rosell-dk

Hi,

I’m not sure if any other plugins are changing the code. I’ve been trying to turn some off and see if any are affecting it but so far nothing is showing up.

This is the option in settings (see attachment).

@.***

From: Bjørn @.> Sent: 09 November 2021 12:46 To: @.> Cc: @.>; @.> Subject: Re: [rosell-dk/webp-express] PHP Errors (Issue #531)

WebP Express uses that code for Alter HTML. It would seem that simple_html_dom.inc gets included twice. It is however surprising, as it does make a test if it is included before doing the including:

        if (!function_exists('str_get_html')) {

            require_once __DIR__ . '/../src-vendor/simple_html_dom/simple_html_dom.inc';

        }

Perhaps some other plugin uses a library which defines constants with the same names as simple_html_dom.

Which option have you btw selected in Alter HTML? "Replace img-tags with picture tags" or "Replace image URLs" ? In 0.22.0, I made a change to "Replace img-tags with picture tags" so it only includes simple_html_dom when DOMDocument is unavailable.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rosell-dk/webp-express/issues/531#issuecomment-964118895, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANQQ2DHX3OI42FDKC3PMB5LULEJZRANCNFSM5HVBNCTQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ObviousInvestor avatar Nov 09 '21 13:11 ObviousInvestor

I don’t have any way to search inside files and I’m not technical enough to figure out how to drop down to Unix and do a grep on my host server (hosted by Hostinger).

From: Bjørn @.> Sent: 09 November 2021 12:48 To: @.> Cc: @.>; @.> Subject: Re: [rosell-dk/webp-express] PHP Errors (Issue #531)

Do you have file search on your server? In that case, it could be interesting to search for "HDOM_TYPE_COMMENT" to see if other code on your site defines that. On linux: grep -r 'HDOM_TYPE_COMMENT' .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rosell-dk/webp-express/issues/531#issuecomment-964120521, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANQQ2DCR3EA22QTLAZJ76MDULEKCHANCNFSM5HVBNCTQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ObviousInvestor avatar Nov 09 '21 13:11 ObviousInvestor

Which option have you btw selected in Alter HTML? "Replace img-tags with picture tags" or "Replace image URLs" ?

rosell-dk avatar Nov 10 '21 08:11 rosell-dk

Hi, it was in the screenshot I sent but it is "Replace img-tags with picture tags"

From: Bjørn @.> Sent: 10 November 2021 08:16 To: @.> Cc: @.>; @.> Subject: Re: [rosell-dk/webp-express] PHP notices (simple_html_dom) (Issue #531)

Which option have you btw selected in Alter HTML? "Replace img-tags with picture tags" or "Replace image URLs" ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rosell-dk/webp-express/issues/531#issuecomment-964882276, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANQQ2DFNV2E43J5WI6V2DFDULIS5NANCNFSM5HVBNCTQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ObviousInvestor avatar Nov 10 '21 08:11 ObviousInvestor

ok, thanks. It seems replying with email doesn't transfer attachments.

I'm still very puzzled how this happens. But I'm going to change the way the library is included and use this composer package that wraps the library instead of including it manually. I wanted to do this anyway. This might solve the issue.

rosell-dk avatar Nov 10 '21 08:11 rosell-dk

Ok, thanks.

I’ll wait until the update come out as I’m not at all familiar with composer.

Thanks again for your excellent support.

Regards,

Mark

From: Bjørn @.> Sent: 10 November 2021 08:32 To: @.> Cc: @.>; @.> Subject: Re: [rosell-dk/webp-express] PHP notices (simple_html_dom) (Issue #531)

ok, thanks. It seems replying with email doesn't transfer attachments.

I'm still very puzzled how this happens. But I'm going to change the way it is included and use this composer packagehttps://github.com/Kub-AT/php-simple-html-dom-parser that wraps the library instead of including it manually. I wanted to do this anyway. This might solve the issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rosell-dk/webp-express/issues/531#issuecomment-964895938, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANQQ2DAOWRLYGUY5SXQ7AXLULIU2JANCNFSM5HVBNCTQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ObviousInvestor avatar Nov 10 '21 08:11 ObviousInvestor

I made the changes and it will be part of the next release. I'm not sure when that will be, but I'll let you know!

rosell-dk avatar Nov 10 '21 08:11 rosell-dk

Thanks again!

From: Bjørn @.> Sent: 10 November 2021 08:59 To: @.> Cc: @.>; @.> Subject: Re: [rosell-dk/webp-express] PHP notices (simple_html_dom) (Issue #531)

I made the changes and it will be part of the next release. I'm not sure when that will be, but I'll let you know!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rosell-dk/webp-express/issues/531#issuecomment-964914835, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANQQ2DGZDFEJTJBR7ZXVKVLULIYAVANCNFSM5HVBNCTQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ObviousInvestor avatar Nov 10 '21 09:11 ObviousInvestor

I just pre-released. You can download 0.23.0 here (look for “Please select a specific version to download”).

I plan to release 0.23.0 tomorrow.

rosell-dk avatar Nov 15 '21 12:11 rosell-dk

Hi Bjorn,

Thanks for the heads up. I’ll just wait until tomorrow when it updates automatically as I’m not near my computer today.

Thanks for the great support.

Cheers,

Mark

From: Bjørn @.> Sent: 15 November 2021 12:22 To: @.> Cc: @.>; @.> Subject: Re: [rosell-dk/webp-express] PHP notices (simple_html_dom) (Issue #531)

I just pre-released. You can download 0.23.0 here (look for “Please select a specific version to download”).

I plan to release 0.23.0 tomorrow.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rosell-dk/webp-express/issues/531#issuecomment-968858793, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANQQ2DE7T2OBL53QSNS7EALUMD3SBANCNFSM5HVBNCTQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ObviousInvestor avatar Nov 15 '21 13:11 ObviousInvestor