Hi. I’m using Kartik’s DepDrop (as I’ve used in the past) and I created an action to return data for a dropdown, but I’m getting a weird error: the server returns error 500, but returns also the content!
For example in the controller I’ve created this action:
public function actionCerca()
Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
return ['output' => , 'selected' => 0];
if I call it from the browser I get Internal Server Error BUT also the JSON encoded array.
The controller is standard, I made no customization and no additional filter or behavior.
indeed I’ve been stupid in not checking web server’s error log! There’s an exception on User model, which is rather strange as I’ve set no authentication in my project. Apparently the debug toolbar still requires an user. Commenting out the debug toolbar in config/web.php fixed. Maybe this is an issue which should be filed to the project?
thanks for the suggestion.
[font=“Courier New”][Mon May 15 07:11:52.170375 2017] [:error] [pid 10203] [client ::1:60493] PHP Fatal error: Uncaught Error: Class ‘app\\models\\User’ not found in /project/vendor/yiisoft/yii2/web/User.php:657