Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Problem wit magic_quotes_gpc set to on
  • Hi all,
    my hosting has magic_quotes_gpc set to on, so every text I insert in the db has a slash before singl and double quote (for example, the text "O'brian" began "O\'brian). How can I delete the slash in every output of my site? I've tried with:
    'output_filter'  => array('Security::htmlentities', 'stripslashes'),
    

    But it doesn't work.
    Any other idea?
  • Tell your host he's a moron, magic quotes has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0. And try switching these, so do a stripslashes before encoding it.
  • I know, I asked them today but they answer it is impossible.
    I've used a function from the php manual that reverse every input with a quote:
            if (get_magic_quotes_gpc()) {
                $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
                while (list($key, $val) = each($process)) {
                    foreach ($val as $k => $v) {
                        unset($process[$key][$k]);
                        if (is_array($v)) {
                            $process[$key][stripslashes($k)] = $v;
                            $process[] = &$process[$key][stripslashes($k)];
                        } else {
                            $process[$key][stripslashes($k)] = stripslashes($v);
                        }
                    }
                }
                unset($process);
            }
    

    For know it works, I call it in my base controller "before" mothod so every input is now ok. Thanks Harro, one day I'll buy you a beer or all the helps :)

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion