recently i've started using laravel. but i am wondering why it crashes and throw exception because of undefined index.
for example:
$arr=[]; return $arr1;
this causing the app to crash and return code 500. this is not good at all. i don't need it to crash, it should just return null.
How could i handle this ?
other suggest to wrap each line with isset for example:
if(isset($arr[1]))
return $arr[1]
i can't go through all my code and wrap each line with isset. that's tough work.
EDIT: this is not a code issue, i am pretty sure this is from laravel ,here is why:
in my laravel project at routes.php file i have set this:
$app->get ( "testException", function (Illuminate\Http\Request $request) {
$arr=[];
return $arr[1];
} );
when i call localhost/testException it throw this error and return exception code 500:
but when i run the same code without using laravel in separate script it runs without any problem.
Thanks
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1W95RCc
via IFTTT
Aucun commentaire:
Enregistrer un commentaire