Debug while creating rest services

So i am doing a small rest service following the guide, using the basic app.

I am using yii in dev mode:


    ini_set('display_errors', 1);

    defined('YII_DEBUG') or define('YII_DEBUG', true);

    defined('YII_ENV') or define('YII_ENV', 'dev');

my log component looks like:

        'log' => [

            'traceLevel' => YII_DEBUG ? 3 : 0,

            'targets'    => [


                    'class'  => 'yii\log\FileTarget',

                    'levels' => ['error', 'warning'],




Now, if i get a php error while developing in a rest controller, all i see in my screen is:


  "name": "Internal Server Error",

  "message": "There was an error at the server.",

  "code": 0,

  "status": 500


And that’s all there is to it, i mean, i should see lots more info in the dev, right?

I have to constantly check the app.log to find out what’s the deal since some of these errors don’t even come up in the debug module/toolbar.

While the the app log clearly says:

2016-01-25 14:46:22 [][-][-][error][Error] 'Error: Undefined class constant \'SCENARIO_CREATE\' in /var/www/vhosts/

The debug module does not catch this, last entry is totally unrelated.

And there are plenty cases when there’s nothing logged into the app.log as well.

I am using php 7 on a linux environment with yii 2.0.6 and 2.0.7-dev if it helps.


Well it’s a bug alright.

yii\web\ErrorHandler::convertExceptionToArray() doesn’t cover the \Error buitln class in PHP.

So instead of :

if (!YII_DEBUG && !$exception instanceof UserException && !$exception instanceof HttpException) {

            $exception = new HttpException(500, 'There was an error at the server.');


it should be

if (!YII_DEBUG && !$exception instanceof UserException && !$exception instanceof HttpException && !$exception instanceof \Error) {

            $exception = new HttpException(500, 'There was an error at the server.');


L.E: Issue created at github: