jeudi 17 décembre 2015

PHP looping through file internal error without logs

I use AJAX to get some JSON data from a file on my server.

Server-side code

 $file = fopen($path);

 /*Headers*/
 $cols = fgetcsv($file);
 $cols[0] = 'id';  

 /*Loop through each line*/
 $file_arr = [];
 while (($line = fgetcsv($file)) !== FALSE) {
     $file_arr[] = array_combine($cols,$line);
     /*The code crashes somewhere during this loop*/
 }
 fclose($file);

/*Returns some JSON*/

However, I get an Internal Error but there's nothing in the log file. I added some Log::Info through out my code and I have managed to find that the error is due to the loop but I cannot figure out what because I do not have log for the internal error.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire