PHP 5 magic quotes turned off? Feb24 '06

I noticed, this morning, that a comment submitted at this site, with a single quote (') was not going through, even though it’s been fine, in the past.

I then realized that I changed my server PHP settings to support PHP 5, about two days ago. I guess this is the first noticeable "bug."

I am assuming that PHP 5 does not support the oft-controversial Magic Quotes feature, whereas previous version do.

Actually, let me correct myself... PHP 5 doesn’t have Magic Quotes turned on automatically. I am guessing it can easily be enabled, but now that it’s not, perhaps I should consider a better implementation for dealing with quotes in forms.

Developers out there, how do you deal with quotes submitted from forms?

Categories: PHP

Add Feedback (view all)

Leave feedback

Feedback

Input format: The editor controls below will assist with Markdown syntax.

Status

Sub-status

Your info

By using addslashes and stripslashes: Addslashes on form values before saving and then stripslashes before you output to browser. V ... Read more.

You should never, ever need to use stripslashes. Make sure you have used addslashes or mysqlrealescape_string before you try to insert tex ... Read more.

matthom is published and produced by Matt Thommes - an independent publishing enthusiast, mobile blogger, content creator, informative writer, web developer from a suburb of Chicago. Never one to conform, Matt intends to promote the effect the web has on our lives, in an effort to intensify, instruct, and clarify all that is happening around us.

Contact Matt

Popular Pages

  1. Fast rounded corners in Photoshop (4156 recent visits)
  2. PHP – passing variables across pages (1560 recent visits)
  3. JavaScript set selected on load (1291 recent visits)
  4. Removing all child nodes from an element (882 recent visits)
  5. iPod songs out of order? (747 recent visits)
  6. Britney - Everytime piano tab (671 recent visits)
  7. Firefox 3 smart address bar: wildcard search (633 recent visits)
  8. MySQL LEFT JOIN syntax (544 recent visits)
  9. Breathe Me - Sia (510 recent visits)
  10. Tumblr: how blogging should be (405 recent visits)

Similar Entries

Stats

22 unique visits since August 2008

Syndicate

Advertisements