Search code examples
symfonystripslashes

Slashes being added with Symfony2 form builder - where do I use stripslashes()?


I'm building a small website with Symfony2 (i.e. not Symfony 1.x). I used the default CRUD generator from an entity created using the CLI generator. However, when it's saved to the database, it's being saved with escaping slashes.

Where is the right place to stop that happening? In the entity, the repostiory, the controller or the form? Is there some magical function for doing it?


Solution

  • Turned out to be nothing to do with Symfony. I'm using MAMP, and magic_quotes_gpc was turned on. For future reference, go to your php.ini file and set

    magic_quotes_gpc = Off
    

    To check whether magic quotes are turned on, run just do

    if(get_magic_quotes_gpc()) { die('magic quotes turned on'); }