Search code examples
cakephp

CakePHP: Debug messages not shown


I have in config/app_local.php this code:

return [
    /*
     * Debug Level:
     *
     * Production Mode:
     * false: No error messages, errors, or warnings shown.
     *
     * Development Mode:
     * true: Errors and warnings shown.
     */
    'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN),
    'DebugKit' => [ 'forceEnable' => TRUE], 
...

Before I had this warning in the log file:

warning: DebugKit is disabling itself as your host `my.example.com` is not in the known safe list of 
   top-level-domains (localhost, invalid, test, example, local). 
   If you would like to force DebugKit on use the `DebugKit.forceEnable` Configure option.

After I set the above code the warning has gone but I still don't see the CakePHP debug window when an error occurs. I see only this:

Fatal error: Declaration of App\Controller\ErrorController::beforeRender(Cake\Event\EventInterface $event) 
  must be compatible with App\Controller\AppController::beforeRender(Cake\Event\EventInterface $event): 
  void in /var/www/vhosts/example.ocm/my.example.com/src/Controller/ErrorController.php on line 54

What am I still missing, doing wrong? The debug message is only in the log file, but I would like to see it also in the browser.


Solution

  • As the error message indicates, the prototypes of the two functions do not match. The : void on the AppController indicates that the function won't return anything. The ErrorController is missing this. They need to match.