• Hi,

    We have been having an issue with one of our WordPress websites. I tracked down the cause to PHP fatal errors that logged:

    Fatal error: Call to a member function find() on a non-object in [...]/wp-content/plugins/seo-friendly-images-for-wp/seo-friendly-images.php on line 170

    as well as some:

    PHP Notice: Use of undefined constant is_admin - assumed 'is_admin' in [...]wp-content/plugins/seo-friendly-images-for-wp/seo-friendly-images.php on line 48)

    I fixed it as follows:

    diff -u --recursive orig/seo-friendly-images-for-wp/seo-friendly-images.php wp-content/plugins/seo-friendly-images-for-wp/seo-friendly-images.php
    ---orig/seo-friendly-images-for-wp/seo-friendly-images.php  2016-03-21 06:09:16.000000000 +0100
    +++ wp-content/plugins/seo-friendly-images-for-wp/seo-friendly-images.php       2017-03-04 17:45:06.381772531 +0100
    @@ -45,7 +45,7 @@
    
         private function actions()
         {
    -        if (is_admin) {
    +        if (is_admin()) {
                 add_filter('plugin_row_meta', array($this, 'plugin_meta_links'), 10, 2);
             }
    
    @@ -167,7 +167,7 @@
    
             $dom = str_get_html($html);
    
    -        foreach($dom->find('img') as $element) {
    +        if ($dom) foreach($dom->find('img') as $element) {
    
                 $image_name = basename($element->src);
                 $image_name = pathinfo($image_name)['filename'];
    @@ -199,4 +199,4 @@
    
    SEO_Friendly_Images::getInstance();
    
    -?>
    \ No newline at end of file
    +?>
    

    I appreciate this might not be totally sufficient or bug-free. Please take all relevant actions.

    Cheers,
    Christophe.

    • This topic was modified 9 years, 2 months ago by ctosidetrade.
Viewing 1 replies (of 1 total)
  • Thanks for the patch. I was having both of those errors. I’d like to see this patch implemented as well.

Viewing 1 replies (of 1 total)

The topic ‘Proposed patch’ is closed to new replies.