Hallo zusammen....
ich hab mal wieder ein kleines Problem wo ich grad fest stecke.
Und zwar möchte ich von PHP 7.0.x auf PHP 7.4.x upgraden. Leider gibt's hier ein Problem mit einem Teil meines Scripts.
PHP 7.0.x funktioniert alles problemlos.
PHP 7.4.2 wirft mir folgende Fehlermeldung:
Fatal error: Uncaught Error: Cannot use string offset as an array in E:\http\gira_qc\functions.php:112 Stack trace: #0 E:\http\gira_qc\realtime_daten.php(364): wr_data_to_array(Array) #1 {main} thrown in E:\http\gira_qc\functions.php on line 112
PHP-Code:
107 var_dump($key_array);
108 // Key-Array und Daten-Array in ein Array zusammenführen
109 foreach ($key_array as $newkey => $data_key){
110
111
112 $wrdata[$ds][$data_key] = $data_array[$i]; // <----
113 $i++;
114
115 }
116 $ds++;
117 }
var_dump($key_array) gibt mir folgendes:
array(12) { [0]=> string(7) "Uhrzeit" [1]=> string(4) "Udc1" [2]=> string(4) "Idc1" [3]=> string(4) "Pdc1" [4]=> string(4) "Udc2" [5]=> string(4) "Idc2" [6]=> string(4) "Pdc2" [7]=> string(4) "Uac1" [8]=> string(4) "Iac1" [9]=> string(3) "Pdc" [10]=> string(3) "Pac" [11]=> string(4) "Tsys" }
$key_array ist also ein Arry, wird in der foreach-Schleife nur einmal durchlaufen und schmeißt den "Fatal Error".
Steh grad aufm Schlauch.