Uncaught exception with 'DB connection error' on line 18

PHP ab 5.4 – Illegal string offset ‚Group‘

Der Embarcadero HTMl5 Builder nutzt seinen eigenen Apache 2.2 mit PHP 5.3. Wenn die Anwendung auf einen Server mit PHP ab Version 5.4 läuft gibt es Fehlermeldung bzw. die Anwendung läuft teilweise gar nicht.

Illegal string offset ‚Group‘ … line 5538 … jmobile.inc.php
Illegal string offset ‚Disabled‘ … line 5541 … jmobile.inc.php
Illegal string offset ‚PlaceHolder‘ … line 5544 … jmobile.inc.php
Illegal string offset ‚Value‘ … 5547 … jmobile.inc.php

sind die Fehlermeldungen in verkürzter Form.
Wenn die Variable kein Array ist und versucht wird sie als array anzusprechen wird diese Warnung ausgegeben.

Als Lösung bietet sich an die Variable, wenn sie auch als Array genutzt wird explizit als Array zu deklarieren.

Vorher ab Zeile 5532:

//Now we will populate the NestedAttributes array for every element
 foreach($this->_items as $key=>$item)
 {
 $groups[$key] = $item['Group'];
$data = array();
 if($item['Disabled'] == "true")
 $data["disabled"] = "disabled";
if($item['PlaceHolder'] == "true")
 $data["data-placeholder"] = "true";
$this->_nestedattributes[$item['Value']] = $data;
 }
//let's reorder the array based on groups so all the elements
//that belong to the same group are together
 array_multisort($groups, $this->_items);
}

Nachher:

//Now we will populate the NestedAttributes array for every element
 foreach($this->_items as $key=>$item)
 {
        if (is_array($item)) {
          $groups[$key] = $item['Group'];

          $data = array();
          if($item['Disabled'] == "true")
            $data["disabled"] = "disabled";

          if($item['PlaceHolder'] == "true")
            $data["data-placeholder"] = "true";

          $this->_nestedattributes[$item['Value']] = $data;
        } else {
          $groups[$key] = $item;
          $data = array();
          $this->_nestedattributes[$item] = $data;
        }
 }
 //let's reorder the array based on groups so all the elements
 //that belong to the same group are together
array_multisort($groups, $this->_items);
}