title: PHP 7.0 Illegal offset type in isset or empty
body: <p>On my Apache <code>ErrorLog</code> file I see many times this warning message:</p>
  
  <blockquote>
    <p>[Wed Aug 23 17:27:25.146025 2017] [:error] [pid 14989] [client 66.249.76.54:44935] PHP Warning:  Illegal offset type in isset or empty in /var/www/html/blog/wp-content/plugins/ilab-media-tools/classes/tools/s3/ilab-media-s3-tool.php on line 1012</p>
  </blockquote>
  
  <p>It's related to a Wordpress plugin, I tried on <a href="https://github.com/Interfacelab/ilab-media-tools/issues/11" rel="nofollow noreferrer">Github</a> to ask help from author (as many others) but nothing.</p>
  
  <p>The warning points to this function:</p>
  
  <pre><code>public function imageDownsize($fail,$id,$size) {
      if (apply_filters('ilab_imgix_enabled', false)) {
              return $fail;
      }
  
      $meta=wp_get_attachment_metadata($id);
      // This is the line of the warning:
      if (!isset($meta['sizes']) || !isset($meta['sizes'][$size])) {
              return $fail;
      }
  
      $sizeMeta = $meta['sizes'][$size];
      if (!isset($sizeMeta['s3'])) {
              return $fail;
      }
  
      $url = $sizeMeta['s3']['url'];
  
      $result=[
              $url,
              $sizeMeta['width'],
              $sizeMeta['height'],
          true
      ];
  
      return $result;
  }
  </code></pre>
  
  <p>Apache prints this warning every minute. <strong>Is there a way to fix this annoying message warning?</strong></p>
  
  <p>This is the output of <code>var_dump($meta);</code>:</p>
  
  <pre><code>array(7) {
    ["width"]=&amp;gt;
    int(140)
    ["height"]=&amp;gt;
    int(140)
    ["file"]=&amp;gt;
    string(31) "2016/01/logo_retina.png"
    ["sizes"]=&amp;gt;
    array(0) {
    }
    ["image_meta"]=&amp;gt;
    array(12) {
      ["aperture"]=&amp;gt;
      int(0)
      ["credit"]=&amp;gt;
      string(0) ""
      ["camera"]=&amp;gt;
      string(0) ""
      ["caption"]=&amp;gt;
      string(0) ""
      ["created_timestamp"]=&amp;gt;
      int(0)
      ["copyright"]=&amp;gt;
      string(0) ""
      ["focal_length"]=&amp;gt;
      int(0)
      ["iso"]=&amp;gt;
      int(0)
      ["shutter_speed"]=&amp;gt;
      int(0)
      ["title"]=&amp;gt;
      string(0) ""
      ["orientation"]=&amp;gt;
      int(0)
      ["keywords"]=&amp;gt;
      array(0) {
      }
    }
    ["ewww_image_optimizer"]=&amp;gt;
    string(30) "Reduced by 16.3% (1.3&amp;nbsp;kB)"
    ["s3"]=&amp;gt;
    array(3) {
      ["url"]=&amp;gt;
      string(79) "https://s3-eu-west-1.amazonaws.com/blog-example/2016/01/logo_retina.png"
      ["bucket"]=&amp;gt;
      string(12) "blog-example"
      ["key"]=&amp;gt;
      string(31) "2016/01/logo_retina.png"
    }
  }
  array(7) {
    ["width"]=&amp;gt;
    int(140)
    ["height"]=&amp;gt;
    int(140)
    ["file"]=&amp;gt;
    string(31) "2016/01/logo_retina.png"
    ["sizes"]=&amp;gt;
    array(0) {
    }
    ["image_meta"]=&amp;gt;
    array(12) {
      ["aperture"]=&amp;gt;
      int(0)
      ["credit"]=&amp;gt;
      string(0) ""
      ["camera"]=&amp;gt;
      string(0) ""
      ["caption"]=&amp;gt;
      string(0) ""
      ["created_timestamp"]=&amp;gt;
      int(0)
      ["copyright"]=&amp;gt;
      string(0) ""
      ["focal_length"]=&amp;gt;
      int(0)
      ["iso"]=&amp;gt;
      int(0)
      ["shutter_speed"]=&amp;gt;
      int(0)
      ["title"]=&amp;gt;
      string(0) ""
      ["orientation"]=&amp;gt;
      int(0)
      ["keywords"]=&amp;gt;
      array(0) {
      }
    }
    ["ewww_image_optimizer"]=&amp;gt;
    string(30) "Reduced by 16.3% (1.3&amp;nbsp;kB)"
    ["s3"]=&amp;gt;
    array(3) {
      ["url"]=&amp;gt;
      string(79) "https://s3-eu-west-1.amazonaws.com/blog-example/2016/01/logo_retina.png"
      ["bucket"]=&amp;gt;
      string(12) "blog-example"
      ["key"]=&amp;gt;
      string(31) "2016/01/logo_retina.png"
    }
  }
  array(7) {
    ["width"]=&amp;gt;
    int(140)
    ["height"]=&amp;gt;
    int(140)
    ["file"]=&amp;gt;
    string(31) "2016/01/logo_retina.png"
    ["sizes"]=&amp;gt;
    array(0) {
    }
    ["image_meta"]=&amp;gt;
    array(12) {
      ["aperture"]=&amp;gt;
      int(0)
      ["credit"]=&amp;gt;
      string(0) ""
      ["camera"]=&amp;gt;
      string(0) ""
      ["caption"]=&amp;gt;
      string(0) ""
      ["created_timestamp"]=&amp;gt;
      int(0)
      ["copyright"]=&amp;gt;
      string(0) ""
      ["focal_length"]=&amp;gt;
      int(0)
      ["iso"]=&amp;gt;
      int(0)
      ["shutter_speed"]=&amp;gt;
      int(0)
      ["title"]=&amp;gt;
      string(0) ""
      ["orientation"]=&amp;gt;
      int(0)
      ["keywords"]=&amp;gt;
      array(0) {
      }
    }
    ["ewww_image_optimizer"]=&amp;gt;
    string(30) "Reduced by 16.3% (1.3&amp;nbsp;kB)"
    ["s3"]=&amp;gt;
    array(3) {
      ["url"]=&amp;gt;
      string(79) "https://s3-eu-west-1.amazonaws.com/blog-example/2016/01/logo_retina.png"
      ["bucket"]=&amp;gt;
      string(12) "blog-example"
      ["key"]=&amp;gt;
      string(31) "2016/01/logo_retina.png"
    }
  }
  array(7) {
    ["width"]=&amp;gt;
    int(140)
    ["height"]=&amp;gt;
    int(140)
    ["file"]=&amp;gt;
    string(31) "2016/01/logo_retina.png"
    ["sizes"]=&amp;gt;
    array(0) {
    }
    ["image_meta"]=&amp;gt;
    array(12) {
      ["aperture"]=&amp;gt;
      int(0)
      ["credit"]=&amp;gt;
      string(0) ""
      ["camera"]=&amp;gt;
      string(0) ""
      ["caption"]=&amp;gt;
      string(0) ""
      ["created_timestamp"]=&amp;gt;
      int(0)
      ["copyright"]=&amp;gt;
      string(0) ""
      ["focal_length"]=&amp;gt;
      int(0)
      ["iso"]=&amp;gt;
      int(0)
      ["shutter_speed"]=&amp;gt;
      int(0)
      ["title"]=&amp;gt;
      string(0) ""
      ["orientation"]=&amp;gt;
      int(0)
      ["keywords"]=&amp;gt;
      array(0) {
      }
    }
    ["ewww_image_optimizer"]=&amp;gt;
    string(30) "Reduced by 16.3% (1.3&amp;nbsp;kB)"
    ["s3"]=&amp;gt;
    array(3) {
      ["url"]=&amp;gt;
      string(79) "https://s3-eu-west-1.amazonaws.com/blog-example/2016/01/logo_retina.png"
      ["bucket"]=&amp;gt;
      string(12) "blog-example"
      ["key"]=&amp;gt;
      string(31) "2016/01/logo_retina.png"
    }
  }
  array(7) {
    ["width"]=&amp;gt;
    int(140)
    ["height"]=&amp;gt;
    int(140)
    ["file"]=&amp;gt;
    string(31) "2016/01/logo_retina.png"
    ["sizes"]=&amp;gt;
    array(0) {
    }
    ["image_meta"]=&amp;gt;
    array(12) {
      ["aperture"]=&amp;gt;
      int(0)
      ["credit"]=&amp;gt;
      string(0) ""
      ["camera"]=&amp;gt;
      string(0) ""
      ["caption"]=&amp;gt;
      string(0) ""
      ["created_timestamp"]=&amp;gt;
      int(0)
      ["copyright"]=&amp;gt;
      string(0) ""
      ["focal_length"]=&amp;gt;
      int(0)
      ["iso"]=&amp;gt;
      int(0)
      ["shutter_speed"]=&amp;gt;
      int(0)
      ["title"]=&amp;gt;
      string(0) ""
      ["orientation"]=&amp;gt;
      int(0)
      ["keywords"]=&amp;gt;
      array(0) {
      }
    }
    ["ewww_image_optimizer"]=&amp;gt;
    string(30) "Reduced by 16.3% (1.3&amp;nbsp;kB)"
    ["s3"]=&amp;gt;
    array(3) {
      ["url"]=&amp;gt;
      string(79) "https://s3-eu-west-1.amazonaws.com/blog-example/2016/01/logo_retina.png"
      ["bucket"]=&amp;gt;
      string(12) "blog-example"
      ["key"]=&amp;gt;
      string(31) "2016/01/logo_retina.png"
    }
  }
  </code></pre>
  
  <p>And the output of <code>var_dump($size);</code>:</p>
  
  <pre><code>string(4) "full"
  array(2) {
    [0]=&amp;gt;
    int(32)
    [1]=&amp;gt;
    int(32)
  }
  array(2) {
    [0]=&amp;gt;
    int(192)
    [1]=&amp;gt;
    int(192)
  }
  array(2) {
    [0]=&amp;gt;
    int(180)
    [1]=&amp;gt;
    int(180)
  }
  array(2) {
    [0]=&amp;gt;
    int(270)
    [1]=&amp;gt;
    int(270)
  }
  </code></pre>