title: Fatal error: Uncaught Error: Cannot use string offset as an array
body: <p>A custom field extension is added to a blog plugin causing this error <strong>"Fatal error: Uncaught Error: Cannot use string offset as an array"</strong> I'm using PHP7 I tried to use array_key_exists() but this didn't solve the error it accidentally disabled the extension</p>
  
  <pre><code>public function getCustomFields()
    {
      $cfData = getXML(BLOGCUSTOMFIELDS);
      $cf = array('options' =&gt; '', 'main' =&gt; '');
      $count_options = 0;
      $count_main = 0;
      $count_opt = 0;
      foreach($cfData-&gt;item as $custom_field)
      {
        if($custom_field-&gt;area == 'options')
        {
          $cf['options'][$count_options]['key'] = (string) $custom_field-&gt;desc;
          $cf['options'][$count_options]['label'] = (string) $custom_field-&gt;label;
          $cf['options'][$count_options]['type'] = (string) $custom_field-&gt;type;
          $cf['options'][$count_options]['value'] = (string) $custom_field-&gt;value;
          if ($custom_field-&gt;type == "dropdown") 
          {
            $count_opt = 0;
            $cf['options'][$count_options]['options'] = array();
            foreach ($custom_field-&gt;option as $option) 
            {
              $cf['options'][$count_options]['options'][] = (string) $option;
              $count_opt++;
            }
          }
          $count_options++;
        }
        elseif($custom_field-&gt;area == 'main')
        {
          $cf['main'][$count_main]['key'] = (string) $custom_field-&gt;desc;
          $cf['main'][$count_main]['label'] = (string) $custom_field-&gt;label;
          $cf['main'][$count_main]['type'] = (string) $custom_field-&gt;type;
          $cf['main'][$count_main]['value'] = (string) $custom_field-&gt;value;
          if ($custom_field-&gt;type == "dropdown") 
          {
            $count_opt = 0;
            $cf['main'][$count_main]['options'] = array();
            foreach ($custom_field-&gt;option as $option) 
            {
              $cf['main'][$count_main]['options'][] = (string) $option;
              $count_opt++;
            }
          }
          $count_main++;
        }
      }
      return $cf;
    }
  </code></pre>
  
  <p>According to the error it's referring to </p>
  
  <blockquote>
    <p>$cf = array('options' => '', 'main' => '');</p>
  </blockquote>
  
  <p>Your help is much appreciated.</p>
  
  <p>EDIT: Dumping the XML File</p>
  
  <blockquote>
    <p>object(SimpleXMLExtended)#483 (1) { ["item"]=> array(8) { [0]=>
    object(SimpleXMLExtended)#484 (4) { ["area"]=> string(7) "options"
    ["desc"]=> string(4) "slug" ["label"]=> string(8) "Slug/URL"
    ["type"]=> string(4) "text" } [1]=> object(SimpleXMLExtended)#485 (4)
    { ["area"]=> string(7) "options" ["desc"]=> string(4) "tags"
    ["label"]=> string(32) "Tags (separate tags with commas)" ["type"]=>
    string(4) "text" } [2]=> object(SimpleXMLExtended)#486 (4) {
    ["area"]=> string(7) "options" ["desc"]=> string(4) "date" ["label"]=>
    string(25) "Publish date (any format)" ["type"]=> string(4) "text" }
    [3]=> object(SimpleXMLExtended)#487 (4) { ["area"]=> string(7)
    "options" ["desc"]=> string(8) "category" ["label"]=> string(30)
    "Assign This Post To A Category" ["type"]=> string(8) "dropdown" }
    [4]=> object(SimpleXMLExtended)#488 (4) { ["area"]=> string(7)
    "options" ["desc"]=> string(6) "author" ["label"]=> string(14)
    "Author's Name:" ["type"]=> string(4) "text" } [5]=>
    object(SimpleXMLExtended)#489 (4) { ["area"]=> string(7) "options"
    ["desc"]=> string(7) "private" ["label"]=> string(15) "Post is
    private" ["type"]=> string(8) "checkbox" } [6]=>
    object(SimpleXMLExtended)#490 (4) { ["area"]=> string(4) "main"
    ["desc"]=> string(5) "title" ["label"]=> object(SimpleXMLExtended)#492
    (0) { } ["type"]=> string(5) "title" } [7]=>
    object(SimpleXMLExtended)#491 (4) { ["area"]=> string(4) "main"
    ["desc"]=> string(7) "content" ["label"]=>
    object(SimpleXMLExtended)#493 (0) { } ["type"]=> string(8) "textarea"
    } } }</p>
  </blockquote>