[support] Strange characters in source of block

Anthony tony at tony-mac.com
Mon Apr 30 16:47:36 UTC 2012


a comment about  magic quotes from the drupal LA group (
http://groups.drupal.org/node/227548#comment-745338)
"

We are writing php code using AMP stacks locally. We I first tried to do an
INSERT to the MySQL database for user input, it would error out because
MySQL uses single quotes as well to define the start and end of the string
values.

Turning on the magic_quotes_gpc setting in PHP places a backslash character
in front of any single or double quote character in data retrieved from a
form. The backslash character tells MySQL to treat the quote as part of the
data and not part of the string delineator. The backslash isn't added to
the data, it's silently stripped away when the data is stored in the table.

WAMP has this off by default as will PHP 5.4 according to the
documentation. I'm told that PHP coders don't like relying on the
magic_quotes_gpc setting, and instead prefer to handle the data themselves.

if (!get_magic_quotes_gpc())
{
$title = addslashes($title);
$author = addslashes($author);

}

Trouble is, you cannot use BOTH. They you get all kinds of double slashes,
etc. and other crazy stuff going on. Combine that with WYSIWYG and it is a
backslash tornado!

I don't know what the WYSIWYG editors or even Drupal does about this, but
try turning off magic_quotes_gpc if you have access tothe PHP.ini or can
override with .phprc file.
"

-- 

*Anthony Stefan Maciejowski*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20120430/e3427909/attachment.html 


More information about the support mailing list