Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Input not stripping slashes
  • Maybe this isn't a feature, but I assumed the input class would strip out slashes?
    class Controller_Test extends Controller
        public function action_index()
            $data['test'] = Input::post('test');
            $this->response->body = View::factory('test', $data);
    
    Then using
    <form action="" method="post">
     <p><?php echo $test; ?></p>
     <textarea name="test"></textarea>
     <input type="submit" />
    </form>
    
    I submit
    "coconuts"
    
    and it returns
    \"coconuts\"
    
    .
  • Input by default doesn't do anything, it just retrieves what is in $_POST. So check $_POST as well. If that also does contain slashes, it's something form related. If it doesn't, that you have some sort of input filter defined in your config. It definately doesn't do an addslashes() along the way...
  • I should have debugged further, it turns out to be a problem with PHP setup by MAMP, but I can't figure out what setting it is as there's no references to magic quotes or anything in php.ini - thanks anyway!
  • I ran into this the other day. The MAMP php.ini file doesn't reference it by default, but you should be able to enter: magic_quotes_gpc = Off into the php.ini file to turn those off. If you have MAMP Pro, you can edit it directly by going to File-->Edit Template. Hope that helps.

Howdy, Stranger!

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

In this Discussion