Title: Minor code bugs
Last modified: August 21, 2016

---

# Minor code bugs

 *  [marblegravy](https://wordpress.org/support/users/marblegravy/)
 * (@marblegravy)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/minor-code-bugs/)
 * A few minor code fixes that I put in to make it work with no errors that I thought
   I would share back here. They may not be an issue for everyone but I was getting
   errors.
 * in responsive-image-polyfill.php from line 357, change the if statement to check
   if $format->fallback exists rather than just looking for a truthy value to stop
   the undefined value error:
 *     ```
       // Add the fallback, if requested
       if($format->fallback)
       ```
   
 * becomes:
 *     ```
       // Add the fallback, if requested
       if(isset($format->fallback))
       ```
   
 * This one was odd though because it only happened on some installs – still, can’t
   hurt.
 * line 64 of config.php I got a deprecated function warning on
    `$value = mysql_escape_string(
   $value);` so updated it to: `$value = mysql_real_escape_string($value);`
 * [http://wordpress.org/plugins/pb-responsive-images/](http://wordpress.org/plugins/pb-responsive-images/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [marblegravy](https://wordpress.org/support/users/marblegravy/)
 * (@marblegravy)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/minor-code-bugs/#post-4281440)
 * Another minor one. I was getting an undefined index warning when trying to pass
   the post thumbnail through get_picture():
 * `RIP::get_picture(the_post_thumbnail());`
 * line 302 of responsive-image-polyfill.php:
 * `if(!$image->attributes['src']) return $image;`
    becomes `if(!isset($image->attributes['
   src'])) return $image;`
 * I assume this is the correct behaviour – that if there is no source, just pass
   the $image var on?
 *  Plugin Author [Jacob Dunn](https://wordpress.org/support/users/spacemanspud/)
 * (@spacemanspud)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/minor-code-bugs/#post-4281525)
 * Hey Marblegravy,
 * Thanks for the heads up on the errors – I’ll get these patched in, it’s always
   nice having the fix along with the error report. As far as the last issue, it’s
   related to your other thread, in that `the_post_thumbnail()` doesn’t return a
   string for the plugin to work with, leaving it with the src undefined. I’ll add
   a sanity check in to just return nothing if it’s passed nothing (or probably 
   better, throw an error, if in WP_DEBUG mode), but hopefully you’ll be able to
   resolve the separate issue there.
 * Thanks!
 *  Thread Starter [marblegravy](https://wordpress.org/support/users/marblegravy/)
 * (@marblegravy)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/minor-code-bugs/#post-4281564)
 * With the fallback image – I got my fix wrong. With my fix, it sets a fallback
   image as every image because it was only testing to see if the variable was set.
   When it was set to false, it was still firing which isn’t what you want and results
   in EVERY image having a fallback *facepalm*.
 * This version works better because it tests if it’s set AND that it’s true:
 *     ```
       // Add the fallback, if requested
       if(isset($format->fallback) && $format->fallback)
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Minor code bugs’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/pb-responsive-images_c3e3f1.svg)
 * [PB Responsive Images](https://wordpress.org/plugins/pb-responsive-images/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pb-responsive-images/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pb-responsive-images/)
 * [Active Topics](https://wordpress.org/support/plugin/pb-responsive-images/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pb-responsive-images/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pb-responsive-images/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [marblegravy](https://wordpress.org/support/users/marblegravy/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/minor-code-bugs/#post-4281564)
 * Status: not a support question