rosell-dk / webp-express

Wordpress plugin for serving autogenerated WebP images instead of jpeg/png to browsers that supports WebP
GNU General Public License v3.0
225 stars 64 forks source link

PHP notices (simple_html_dom) #531

Open ObviousInvestor opened 2 years ago

ObviousInvestor commented 2 years ago

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
rosell-dk commented 2 years ago

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 commented 2 years ago

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' .

ObviousInvestor commented 2 years ago

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 commented 2 years ago

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.

rosell-dk commented 2 years ago

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

ObviousInvestor commented 2 years ago

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.

rosell-dk commented 2 years ago

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.

ObviousInvestor commented 2 years ago

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.

rosell-dk commented 2 years ago

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!

ObviousInvestor commented 2 years ago

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.

rosell-dk commented 2 years ago

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.

ObviousInvestor commented 2 years ago

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.

IonTulbure commented 1 year ago

Hi. 7/10/2023 - still getting these php Warnings on php 8.1 environment.

ScottKemp commented 8 months ago

I have replicated this on my site, getting tons of Warnings. Did a search and there are two plugins that also have those names: https://wordpress.org/plugins/wp-retina-2x/ https://wordpress.org/plugins/maxbuttons/

webp-express is the only plugin that is throwing the warning."

Got 8,000 warnings in one day. Would be nice to get this fixed.