Slashes inserted everywhere in posts

Found a bug? Tell us!!
Post Reply
doctawojo
Posts: 2
Joined: Fri Sep 16, 2005 2:42 am

Slashes inserted everywhere in posts

Post by doctawojo »

I don't know if this qualifies as a bug. It appears that my host has recently done a massive update, perhaps including changing the PHP version (it's now 4.4.7). The result of this for me has been that when I edit or create a post, slashes are inserted before every apostrophe, quote, and slash. Thus, I type "aren't" and, upon hitting save, I see (and on the web is) the word "aren/'t".

I googled this and there's a post on this forum from a few years ago saying that the problem was likely PHP's smart quotes.

http://board.s9y.org/viewtopic.php?p=26 ... a77bffc245

The solution was to put the line "set_magic_quotes_runtime( 0 );" into the file serendipity_functions.inc.php. This file no longer seems to exist in Serendipity. (?) So I'm not sure what to do. Any ideas? Thanks!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Slashes inserted everywhere in posts

Post by garvinhicking »

Hi!

I would suggest you to talk to your provider so that they can revert this "magic_quotes_runtime" behavior, because it actually disturbs a lot of functionality!

In newer s9y versions you can try to put that PHP command into the "serendipity_config.inc.php" file at the top of it.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
doctawojo
Posts: 2
Joined: Fri Sep 16, 2005 2:42 am

Post by doctawojo »

Garvin,

Thanks for the very prompt response.

Unfortunately, putting that line into that file doesn't work. While waiting for my host to deal with this, I started looking through the code and found that in include/compat.inc.php, there's a section labeled with the following comment:

/*
* Avoid magic_quotes_gpc issues
* courtesy of iliaa@php.net
*/

The test for whether to run the function defined there is

if (ini_get('magic_quotes_gpc')) {

If I change this to a simple "if(1)" the function seems to run because backslashes are no longer being added willy-nilly to my posts, and thus, at least superficially, my problem is solved.

Now, it's certainly possible that this could break something else, so I still want to get my host to change things on their end. But I thought I'd post this to show how I ended up (for now) fixing things.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Yeah, adding that change definitely helps. It might be because your provider disabled the ini_get() function. But definitely something changed in their PHP configuration for worse. :(

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply