Support » Plugin: Gallery Custom Links » Coding error generates huge Apache error logs

  • Resolved highgatecreative

    (@highgatecreative)


    This is really a message to the developer:

    I wondered why I had a 554mb error log (since Oct ’19). Apparently, every time a link is clicked it generates a 5K error. An example of 1 of the 18 lines:
    Constant HDOM_TYPE_ELEMENT already defined in /var/www/susites/mywebsite/htdocs/wp-content/plugins/gallery-custom-links/vendor/kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php on line 66 (repeats for lines 67–82, 97).

    I thought of just commenting it out, but don’t want to tamper with a public plugin.

    Be happy to write a review, but this needs to be addressed.

    Brad

Viewing 6 replies - 1 through 6 (of 6 total)
  • Same here. The full set of notices (and one deprecated entry):

    [20-May-2020 01:32:37 UTC] PHP Notice:  Constant HDOM_TYPE_ELEMENT already defined in wp-content/plugins/gallery-custom-links/vendor/kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php on line 66
    [20-May-2020 01:32:37 UTC] PHP Notice:  Constant HDOM_TYPE_COMMENT already defined in wp-content/plugins/gallery-custom-links/vendor/kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php on line 67
    [20-May-2020 01:32:37 UTC] PHP Notice:  Constant HDOM_TYPE_TEXT already defined in wp-content/plugins/gallery-custom-links/vendor/kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php on line 68
    [20-May-2020 01:32:37 UTC] PHP Notice:  Constant HDOM_TYPE_ENDTAG already defined in wp-content/plugins/gallery-custom-links/vendor/kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php on line 69
    [20-May-2020 01:32:37 UTC] PHP Notice:  Constant HDOM_TYPE_ROOT already defined in wp-content/plugins/gallery-custom-links/vendor/kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php on line 70
    [20-May-2020 01:32:37 UTC] PHP Notice:  Constant HDOM_TYPE_UNKNOWN already defined in wp-content/plugins/gallery-custom-links/vendor/kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php on line 71
    [20-May-2020 01:32:37 UTC] PHP Notice:  Constant HDOM_QUOTE_DOUBLE already defined in wp-content/plugins/gallery-custom-links/vendor/kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php on line 72
    [20-May-2020 01:32:37 UTC] PHP Notice:  Constant HDOM_QUOTE_SINGLE already defined in wp-content/plugins/gallery-custom-links/vendor/kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php on line 73
    [20-May-2020 01:32:37 UTC] PHP Notice:  Constant HDOM_QUOTE_NO already defined in wp-content/plugins/gallery-custom-links/vendor/kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php on line 74
    [20-May-2020 01:32:37 UTC] PHP Notice:  Constant HDOM_INFO_BEGIN already defined in wp-content/plugins/gallery-custom-links/vendor/kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php on line 75
    [20-May-2020 01:32:37 UTC] PHP Notice:  Constant HDOM_INFO_END already defined in wp-content/plugins/gallery-custom-links/vendor/kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php on line 76
    [20-May-2020 01:32:37 UTC] PHP Notice:  Constant HDOM_INFO_QUOTE already defined in wp-content/plugins/gallery-custom-links/vendor/kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php on line 77
    [20-May-2020 01:32:37 UTC] PHP Notice:  Constant HDOM_INFO_SPACE already defined in wp-content/plugins/gallery-custom-links/vendor/kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php on line 78
    [20-May-2020 01:32:37 UTC] PHP Notice:  Constant HDOM_INFO_TEXT already defined in wp-content/plugins/gallery-custom-links/vendor/kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php on line 79
    [20-May-2020 01:32:37 UTC] PHP Notice:  Constant HDOM_INFO_INNER already defined in wp-content/plugins/gallery-custom-links/vendor/kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php on line 80
    [20-May-2020 01:32:37 UTC] PHP Notice:  Constant HDOM_INFO_OUTER already defined in wp-content/plugins/gallery-custom-links/vendor/kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php on line 81
    [20-May-2020 01:32:37 UTC] PHP Notice:  Constant HDOM_INFO_ENDSPACE already defined in wp-content/plugins/gallery-custom-links/vendor/kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php on line 82
    [20-May-2020 01:32:37 UTC] PHP Notice:  Constant HDOM_SMARTY_AS_TEXT already defined in wp-content/plugins/gallery-custom-links/vendor/kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php on line 97
    [20-May-2020 01:32:27 UTC] PHP Deprecated:  Array and string offset access syntax with curly braces is deprecated in wp-content/plugins/gallery-custom-links/mgcl_linker.php on line 49

    Using PHP 7.4.6, WordPress 5.4.1.

    I silenced them by switching the Parsing Engine from HtmlDomParser to DiDom under Meow Apps → Custom Links.

    Plugin Author Jordy Meow

    (@tigroumeow)

    Hi,

    This is generated by an external library used by the plugin. Unfortunately, the fix can’t (and shouldn’t) be made at the plugin level, but at the library level. It’s quite a common library and I think they will fix it. As a matter of fact, I released a new version of the plugin today and I also upgraded this library to its latest version, so that might fix it.

    If you are running a production environment, you should probably turn off PHP notices 🙂 They are just information, and not errors.

    Thread Starter highgatecreative

    (@highgatecreative)

    Thanks for replying, Jordy.

    I’ve replaced:

    define('WP_DEBUG', false);

    with:

    
    ini_set('display_errors','Off');
    ini_set('error_reporting', E_ALL );
    define('WP_DEBUG', false);
    define('WP_DEBUG_DISPLAY', false);
    

    Even so, the code smell should be addressed.

    Brad

    Thread Starter highgatecreative

    (@highgatecreative)

    FYI, the update to the plugin today did not fix the problem. 4 clicks and 13000+K, with error notices off, 0.

    Brad

    Plugin Author Jordy Meow

    (@tigroumeow)

    I am not sure you are aware of that (since you reviewed the plugin as having sloppy code), but it’s not the plugin’s fault. The library should actually only load if it hasn’t be loaded already, but it doesn’t do that.

    You should also know that you also are running another plugin which loads this same library. The error appears to be in my plugin simply because my plugin is loaded after that other plugin, but it could have been the contrary.

    I am not trying to find excuses, just stating facts 🙂 I am not annoyed or anything, I am just saying.

    You could disable the plugins that other plugin, which uses the same library, and disable it if you don’t need it.

    Also, in this plugin settings, you could switch to DiDom, which is much faster and better (but doesn’t always work depending on how your HTML is written – DiDom is more sensitive and needs perfectly-written HTML).

    Thread Starter highgatecreative

    (@highgatecreative)

    Jordy,

    I concur. Your plugin is fine and works as advertised. And I just checked: you are correct—responsive-lightbox also uses simple_html_dom.php, the culprit AFAIK.

    And believe me, I’m not without fault; I’m personally responsible for lots of code smell, and often the same ones you see in these logs. That said, simple_html_dom.php generates a disproportionate amount of errors. I turned off the notices, per your suggestion, but no wild about doing that in case I miss something else.

    Thanks for your explanation and your work on this plugin.

    Brad

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Coding error generates huge Apache error logs’ is closed to new replies.