Monthly Archives: November 2014

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:

$ 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:


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! :)

Online Regex Editor

I don’t know about you, but it isn’t the funnest part of my job when I have to pull out Regular Expressions and make a super long expression to match something… I especially dispise when I have to fix someone else’s Regex!


You try figuring out what that does!

Well, it doesn’t have to be as painful with the online regex tool I recently found out about:

On this site, you can write regex and sample text that needs to be matched and it will highlight whether it matches or not.


As well as get helpful hints to remember what the special characters mean:


Regex can definitely be confusing as many characters have special meaning based on the context – are we talking about a literal “:” or a ?: that means non-capturing group?

All in all, this tool makes Regular Expressions so easy! They also have a community feature so you can see if someone has uploaded a Regex pattern that you can build off of.

For my project today, I had to build a Regex that matches a semver version string. Here’s the Regex pattern I built with a little help from my coworker – thanks Daniel!