Tag Archives: debugging

Why Can’t I Put Debug Statements in Symfony Core?

Just a quick tip for anyone running trying to debug symfony core files, such as \Symfony\Component\HttpFoundation\Request or almost anything in HttpFoundation. Just tried adding a debug print_r() and was wondering why my code was not being executed. There doesn’t seem to be any other place where the Request is defined… I thought maybe it is a cache issue, so I did:

1
$ app/console cache:clear

It didn’t help… It turns out that all these files are cached and lumped into the app/bootstrap.php.cache file and that is only regenerated through a composer install via:

Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap

So to summarize, if you want to add debug statements to HttpFoundation classes, you’ll have to edit the bootstrap.php.cache file. Be careful though and don’t mess up your framework! Hope this helps somebody! :)