CakePHP "Fatal error: Class 'Debugger' not found" in a File That Doesn't Reference Debugger CakePHP "Fatal error: Class 'Debugger' not found" in a File That Doesn't Reference Debugger php php

CakePHP "Fatal error: Class 'Debugger' not found" in a File That Doesn't Reference Debugger


This is due to a a PHP bug that did not perform auto loading for compile time errors (e.g., E_STRICT).

This was fixed in PHP 5.4.21 and a workaround pull request was accepted by CakePHP.

To manually workaround this issue and exempt E_STRICT from CakePHP's error handler:

  1. Open core.php in your preferred editor (you could find the file by performing something like find . -name core.php).
  2. Find the following line: 'level' => E_ALL & ~E_DEPRECATED,
  3. Replace it with: 'level' => E_ALL & ~E_DEPRECATED & ~E_STRICT,


I found the error.

This class that I've shown has the initialize method implemented. But it's implemented as

public function initialize($controller)

This is an E_STRICT error since it differs from the parent method by leaving out the type hint. My setup is catching E_STRICT errors. This error is causing it to look for Debugger. I'm not sure why it's not able to autoload it, but changing the method to

public function initialize(Controller $controller)

fixed the issue I was having.


This occurs any time you have an E_STRICT error. The main one I had was when running PHP 5.4, you are required to have public, private, and protected function declarations.