Title: Proposed patch
Last modified: March 4, 2017

---

# Proposed patch

 *  [ctosidetrade](https://wordpress.org/support/users/ctosidetrade/)
 * (@ctosidetrade)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/proposed-patch/)
 * 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](https://wordpress.org/support/users/ctosidetrade/).

Viewing 1 replies (of 1 total)

 *  [ClaytonL](https://wordpress.org/support/users/claytonl/)
 * (@claytonl)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/proposed-patch/#post-9013797)
 * 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.

 * ![](https://ps.w.org/seo-friendly-images-for-wp/assets/icon-256x256.png?rev=1375375)
 * [SEO Friendly Images](https://wordpress.org/plugins/seo-friendly-images-for-wp/)
 * [Support Threads](https://wordpress.org/support/plugin/seo-friendly-images-for-wp/)
 * [Active Topics](https://wordpress.org/support/plugin/seo-friendly-images-for-wp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/seo-friendly-images-for-wp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/seo-friendly-images-for-wp/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [ClaytonL](https://wordpress.org/support/users/claytonl/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/proposed-patch/#post-9013797)
 * Status: not resolved