We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Form field adding \' on sumission

When I write something like " Let's go " on any of my text fields, they're being saved as " Let\'s go " on the DB. I have tracked this string being like this already in the BeforeValidation event in the Form object that receives it. What am I missing?

Here's an example of the field definition in the form object for one of the problem fields:

    //ABOUT
    $about = new Textarea("about");
    $about->setFilters(array('trim', 'striptags'));


98.9k

It seems that magic_quotes_gpc is enabled in your system so any ' or " is automatically escaped by PHP

You can disable it in your php.ini or in the VirtualHost configuration by adding:

php_flag magic_quotes_gpc Off

https://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-gpc

Thanks so much. That was it