Welcome Guest, Not a member yet? Register   Sign In
Automatic stripslashes() of everything retrieved from database?

When using the ActiveRecord database classes, the data (by default) is automatically escaped using the XSS-Clean stuff. So naturally there can end up being a lot of data in the database that is escaped with backslashes.

Is there anyway to automatically strip the slashes of all the data retrieved from the database in my models?

I can obviously just use stripslashes() on the data when I use/echo it in my views, but it would be nice not have have to stripslashes() for every single bit of data... I figured maybe there is an easy way for CI to do it for you when you are retrieving the data? Any clues?

A couple of things come to mind here... what version of PHP are you running? If magic_quotes_runtime is somehow being forced on, then you could end up with the slashes in your DB. The other thing that could cause them is the method in which you're inserting data into your database. I don't believe XSS filtering by itself is going to cause this. Could you post a quick snippet of your data insert methods?

I've never had to strip slashes from data retrieved via active record...what are you doing to you data before inserting?

@CroNiX - What's the point of posting something that reiterates what I've already asked?

I was mistaken. The test code that was written was not using Active Record and the slashes were being added manually. So feel free to ignore this thread. Thanks!

@D13, they were posted at the same time...look at the date/time.

Hey you're right! Apparently I was being an ass Smile

Theme © iAndrew 2016 - Forum software by © MyBB