Title: Uninitialized string offset error when searching for issues
Last modified: August 20, 2016

---

# Uninitialized string offset error when searching for issues

 *  Resolved [jwarren](https://wordpress.org/support/users/jwarren/)
 * (@jwarren)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/uninitialized-string-offset-error-when-searching-for-issues/)
 * I’m using WP 3.5 and WP-Retina 0.8.
 * On the WP-Retina page, when I search for issues, I receive the following error
   message (several times)
 * `Notice: Uninitialized string offset: 0 in /home/mywebsite/www.mywebsiteaddress.
   placeholder/www/wp-content/plugins/wp-retina-2x/wp-retina-2x.php on line 219`
 * The [relevant line](http://plugins.trac.wordpress.org/browser/wp-retina-2x/trunk/wp-retina-2x.php#L219)
   is:
 * `$original_width = $meta['width'];`
 * [http://wordpress.org/extend/plugins/wp-retina-2x/](http://wordpress.org/extend/plugins/wp-retina-2x/)

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

 *  Plugin Author [Jordy Meow](https://wordpress.org/support/users/tigroumeow/)
 * (@tigroumeow)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/uninitialized-string-offset-error-when-searching-for-issues/#post-3264557)
 * Hey jwarren,
 * This is strange because only the images are sent through this function, and they
   must have a width and height, except if of course if something is broken.
 * I tried to reproduced this issue but I can’t.
 * Can you do something for me? Modify the “function wr2x_retina_info( $id )” and
   after the line “$meta = wp_get_attachment_metadata($id);”, please add:
 * if ( !isset( $meta[‘width’] ) ) {
    print_r( $meta ); return $result; }
 * We will then get more information instead of that notice. Please share your findings
   with me. I am not sure it’s a problem linked to the Retina plugin…
 *  Plugin Author [Jordy Meow](https://wordpress.org/support/users/tigroumeow/)
 * (@tigroumeow)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/uninitialized-string-offset-error-when-searching-for-issues/#post-3264558)
 * Okay, I could reproduce the issue : I took random files (PSD, TXT, DOC, PDF…)
   and change their extension to an image extension, then I got exactly the same
   issue as yours.
 * It shouldn’t occur though, I think some of your media either have an incorrect
   extension, or their WordPress metadata has been erased (how? I have no idea… 
   maybe a plugin does that? still strange).
 * I updated the code of the plugin to ignore those files so the warnings or notices
   will not appear anymore. If you want the code to be updated, forget the previous
   code I gave you and use this one instead:
 * if ( !isset( $meta, $meta[‘width’], $meta[‘height’] ) ) {
    return $result; }
 *  Plugin Author [Jordy Meow](https://wordpress.org/support/users/tigroumeow/)
 * (@tigroumeow)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/uninitialized-string-offset-error-when-searching-for-issues/#post-3264563)
 * No need to do anything, just update the plugin to the last version and the “notices”
   will be gone 🙂
 *  Thread Starter [jwarren](https://wordpress.org/support/users/jwarren/)
 * (@jwarren)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/uninitialized-string-offset-error-when-searching-for-issues/#post-3264580)
 * Jordy, thank you very much! You’re a star. Btw, is there any idea of how to identify
   which files are malformed? We have approx 500 images in this site, so can’t realistically
   go through one by one.
 *  Plugin Author [Jordy Meow](https://wordpress.org/support/users/tigroumeow/)
 * (@tigroumeow)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/uninitialized-string-offset-error-when-searching-for-issues/#post-3264588)
 * Maybe there is a way to do it using a plugin which has this purpose? I have no
   idea if there is one…
 * Anyway, you can change the code of the plugin so that it will display those attachment.
 * Look at the wp-retina-2x.php file, go to to the line 220 and change this:
    if(!
   isset( $meta, $meta[‘width’], $meta[‘height’] ) ) { return $result; }
 * to this:
 * if ( !isset( $meta, $meta[‘width’], $meta[‘height’] ) ) {
    echo “[Attachment ” . $id . “](https://wordpress.org/support/topic/uninitialized-string-offset-error-when-searching-for-issues/media.php?attachment_id=" . $id . "&action=edit)”.
   return $result; }
 * Try it, then it should display links to the attachments with issues.
 * By the way, thanks for rating my plugin if you like it ^^

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

The topic ‘Uninitialized string offset error when searching for issues’ is closed
to new replies.

 * ![](https://ps.w.org/wp-retina-2x/assets/icon-256x256.png?rev=2597316)
 * [Perfect Images: Regenerate Thumbnails, Image Sizes, WebP & AVIF](https://wordpress.org/plugins/wp-retina-2x/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-retina-2x/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-retina-2x/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-retina-2x/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-retina-2x/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-retina-2x/reviews/)

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)
 * [Uninitialized string offset](https://wordpress.org/support/topic-tag/uninitialized-string-offset/)

 * 5 replies
 * 2 participants
 * Last reply from: [Jordy Meow](https://wordpress.org/support/users/tigroumeow/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/uninitialized-string-offset-error-when-searching-for-issues/#post-3264588)
 * Status: resolved