stripslashes not working?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

stripslashes not working?

Post by Luke »

I have a method like this in my application model:

Code: Select all

public function getSafe($key){
	
		if(array_key_exists($key, $this->_fields)){
			return htmlentities(stripslashes($this->_fields[$key]->getValue()));
		}
		return null;
	
	}
It's used to escape data for output to the page, but even though I'm using this... the data comes out like this... (with the slashes still there)

Code: Select all

<div class="member_list">
   <h1>Luke\'s House</h1>
   <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean cursus dolor id neque. Vestibulum lobortis luctus augue. Nunc velit. Fusce ultrices massa nec felis. Quisque ut justo. Nulla auctor ornare lorem. Nunc sit amet eros. Phasellus ultricies est </p>
  </div>
I checked to make sure the data wasn't double backslashed in the data, and it isn't. What could be the cause of this?
User avatar
churt
Forum Commoner
Posts: 39
Joined: Wed Oct 04, 2006 9:59 am

Possible

Post by churt »

Found this note on the manual page. From your previous post you probably have checked this already or it doesn't apply. Looks like a possible though.

http://us3.php.net/manual/en/function.stripslashes.php

"Note: If magic_quotes_sybase is on, no backslashes are stripped off but two apostrophes are replaced by one instead."
Post Reply