Skip to content

Remove debugging class cache and bootstrap section #8043

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions debug/debugging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,53 +14,6 @@ configuration is optimized for two main purposes:
* Be as similar as possible as the production environment to avoid problems
when deploying the project.

Disabling the Bootstrap File and Class Caching
----------------------------------------------

And to make the production environment as fast as possible, Symfony creates
big PHP files in your cache containing the aggregation of PHP classes your
project needs for every request. However, this behavior can confuse your debugger,
because the same class can be located in two different places: the original class
file and the big file which aggregates lots of classes.

This recipe shows you how you can tweak this caching mechanism to make it friendlier
when you need to debug code that involves Symfony classes.

The ``app_dev.php`` front controller reads as follows by default::

// ...

$loader = require __DIR__.'/../app/autoload.php';
Debug::enable();

$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
// ...

To make your debugger happier, disable the loading of all PHP class caches
by removing the call to ``loadClassCache()``::

// ...

$loader = require_once __DIR__.'/../app/autoload.php';
Debug::enable();

$kernel = new AppKernel('dev', true);
// $kernel->loadClassCache();
$request = Request::createFromGlobals();

.. tip::

If you disable the PHP caches, don't forget to revert after your debugging
session.

Some IDEs do not like the fact that some classes are stored in different
locations. To avoid problems, you can either tell your IDE to ignore the PHP
cache files, or you can change the extension used by Symfony for these files::

$kernel->loadClassCache('classes', '.php.cache');

Useful Debugging Commands
-------------------------

Expand Down