title: PHP message: PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string
body: <p>I get following error:</p>
  <pre><code>PHP message: PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string
  </code></pre>
  <p>on this line:</p>
  <pre><code>if ($uploadZoneData[1]['size'] != 0) {
  </code></pre>
  <p>On php 7.4 i had any troube but with php 8 i have.</p>
  <p>What can be the problem?</p>
  <p>EDIT: Full code of the related functions:</p>
  <pre><code>function uploadSingleFile($zoneImage, $fileMoveTo, $fileAllowedExtensions, $fileAllowedSize, $zoneCustomer, $zone)
  {
      global $config;
  
      // define file upload settings
      $errors = array();
      $fileName = $zoneImage['name'];
      $fileSize = $zoneImage['size'];
      $fileTmp = $zoneImage['tmp_name'];
      $fileType = $zoneImage['type'];
      $fileExt = strtolower(end(explode('.', $zoneImage['name'])));
      $MBtoByte = $fileAllowedSize * 1048576;
      $extensions= $fileAllowedExtensions;
  
      // define errors
      if (in_array($fileExt, $extensions) === false) {
          $errors[] = &quot;Dieser Datei-Typ ist nicht erlaubt&quot;;
      }
  
      if ($fileSize &gt; $MBtoByte) {
          $errors[] = 'Die Datei ist zu gross';
      }
  
      // finally try to upload the file
      if (empty($errors) == true) {
          $temp = explode(&quot;.&quot;, $zoneImage[&quot;name&quot;]);
          $newfilename = $zoneCustomer . '-' . strtoupper($zone) . '-' . uniqid() . '.' . end($temp);
  
          move_uploaded_file($fileTmp, $_SERVER[&quot;DOCUMENT_ROOT&quot;] . $fileMoveTo . $newfilename);
          $status = '1';
      } else {
          $status = '0';
      }
  
      // build array of the different outputs
      $uploadStatus = array($status, $newfilename, $errors);
  
      return $uploadStatus;
  }
  
  function updateZoneData($zoneFile, $zoneCustomer, $zone, $zoneLink, $maxWidth, $bannerID)
  {
      global $db;
  
      // get customer values
      $getCustomerValues = getColumnValue('customers', &quot;WHERE `customerNr` = '&quot; . $zoneCustomer . &quot;'&quot;);
  
      // define redirect url
      switch ($zone) {
        case &quot;a1&quot;:
          $redirectZone = &quot;zones.php#zones-overview-a1-overview&quot;;
        break;
        case &quot;a2&quot;:
          $redirectZone = &quot;zones.php#zones-overview-a2-overview&quot;;
        break;
        case &quot;b1&quot;:
          $redirectZone = &quot;zones.php#zones-overview-b1-overview&quot;;
        break;
        case &quot;b2&quot;:
          $redirectZone = &quot;zones.php#zones-overview-b2-overview&quot;;
        break;
        case &quot;b3&quot;:
          $redirectZone = &quot;zones.php#zones-overview-b3-overview&quot;;
        break;
        case &quot;b4&quot;:
          $redirectZone = &quot;zones.php#zones-overview-b4-overview&quot;;
        break;
        case &quot;a9&quot;:
          $redirectZone = &quot;zones.php#zones-overview-a9-overview&quot;;
        break;
        case &quot;a9-1&quot;:
          $redirectZone = &quot;zones.php#zones-overview-a9-1-overview&quot;;
        break;
        case &quot;a11&quot;:
          $redirectZone = &quot;zones.php#zones-overview-a11-overview&quot;;
        break;
        default:
          $redirectZone = &quot;zones.php&quot;;
        }
  
      // upload file to the server
      $uploadZoneData = uploadSingleFile($zoneFile, '/adserver/banners/', array(&quot;jpg&quot;, &quot;jpeg&quot;, &quot;png&quot;, &quot;gif&quot;), '3', $zoneCustomer, $zone);
  
      if ($uploadZoneData[1]['size'] != 0) {
          if ($uploadZoneData[0] == '1') {
  
              // create ZIP-Backup (zone-banners) from '/adserver/banners' to '/cp/includes/files/zip-backups'
              createZipBackup('/adserver/banners', '/cp/includes/files/zip-backups', 'adserver-banners.zip');
  
              // get zone values &amp; delete old bannerImg from file-system
              $getZoneDeleteValues = getColumnValue('zones', &quot;WHERE `customerNr` = '&quot; . $zoneCustomer . &quot;' AND `zone` = '&quot; . $zone . &quot;' AND `id` = '&quot; . $bannerID . &quot;'&quot;);
              unlink($_SERVER[&quot;DOCUMENT_ROOT&quot;] . '/adserver/banners/' . $getZoneDeleteValues['0']['bannerImg']);
  
              // execute action
              $updateZoneData = $db-&gt;update(&quot;zones&quot;, [
                                                     &quot;customerNr&quot; =&gt; $zoneCustomer,
                                                     &quot;customer&quot; =&gt; $getCustomerValues['0']['customer'],
                                                     &quot;zone&quot; =&gt; $zone,
                                                     &quot;bannerImg&quot; =&gt; $uploadZoneData[1],
                                                     &quot;bannerLink&quot; =&gt; $zoneLink,
                                                     &quot;maxWidth&quot; =&gt; $maxWidth,
                                                     &quot;changeDate&quot; =&gt; date(&quot;Y-m-d H:i:s&quot;)
                                                     ], [
                                                        &quot;id&quot; =&gt; $bannerID
                                                        ]);
  
              redirectTo($redirectZone, 1, &quot;« &quot; . strtoupper($zone) . &quot;-Banner (&quot; . $getCustomerValues['0']['customer'] . &quot; [K. N°: &quot; . $zoneCustomer . &quot;]) » wurde erfolgreich aktualisiert.&quot;, 'ZONES');
          } else {
  
          // collect and save errors (file-upload)
              $collectedErrors = array_flatten($uploadZoneData[2]);
              setcookie(&quot;collectedErrors&quot;, '1', time() + (1 * 5), &quot;/&quot;); // expire in 5 seconds
              $_SESSION[&quot;collectedErrors&quot;] = $collectedErrors;
  
              redirectTo($redirectZone, 0, &quot;« &quot; . strtoupper($zone) . &quot;-Banner (&quot; . $getCustomerValues['0']['customer'] . &quot; [K. N°: &quot; . $zoneCustomer . &quot;]) » konnte nicht aktualisiert werden.&quot;, 'ZONES');
          }
      } else {
  
          // execute action
          $updateZoneData = $db-&gt;update(&quot;zones&quot;, [
                                                 &quot;customerNr&quot; =&gt; $zoneCustomer,
                                                 &quot;customer&quot; =&gt; $getCustomerValues['0']['customer'],
                                                 &quot;zone&quot; =&gt; $zone,
                                                 &quot;bannerLink&quot; =&gt; $zoneLink,
                                                 &quot;maxWidth&quot; =&gt; $maxWidth,
                                                 &quot;changeDate&quot; =&gt; date(&quot;Y-m-d H:i:s&quot;)
                                                 ], [
                                                    &quot;id&quot; =&gt; $bannerID
                                                    ]);
  
          redirectTo($redirectZone, 1, &quot;« &quot; . strtoupper($zone) . &quot;-Banner (&quot; . $getCustomerValues['0']['customer'] . &quot; [K. N°: &quot; . $zoneCustomer . &quot;]) » wurde erfolgreich aktualisiert.&quot;, 'ZONES');
      }
  }
  </code></pre>