Page 1 of 1

Slashes inserted everywhere in posts

Posted: Mon Feb 04, 2008 8:10 pm
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!

Re: Slashes inserted everywhere in posts

Posted: Tue Feb 05, 2008 11:18 am
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

Posted: Tue Feb 05, 2008 4:13 pm
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.

Posted: Tue Feb 05, 2008 4:20 pm
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