boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Duplicated single quotes in posts

 
Post new topic   Reply to topic    boardom Forum Index -> PHP help
View previous topic :: View next topic  
Author Message
tsalzer



Joined: 23 Jan 2003
Posts: 5
Location: Washington

PostPosted: Thu Jan 23, 2003 6:20 am    Post subject: Duplicated single quotes in posts Reply with quote

Problem: Posts with single quotes are displayed with duplicated or multiple apostrophes when posted and edited/saved.

Example:
Code:
I've
becomes
Code:
I''''ve


Details of my installation: b2 version 0.6.1 running on a Linux box with PHP 4.0.6. According to phpinfo, magic_quotes_gpc and magic_quotes_runtime are off.

Suggestions to resolve this problem will be most welcome.

Tom
Back to top
View user's profile Send private message
tsalzer



Joined: 23 Jan 2003
Posts: 5
Location: Washington

PostPosted: Fri Jan 24, 2003 5:22 pm    Post subject: Reply with quote

While I'm new to this forum I had hoped someone would be able to post some helpful comments before now.

I like the b2 system, but if I can't resolve my multiple apostrophe problem, I will have to abandon it Sad
Back to top
View user's profile Send private message
macshack



Joined: 17 Jul 2002
Posts: 1204
Location: Phoenix, Az

PostPosted: Fri Jan 24, 2003 6:55 pm    Post subject: Reply with quote

Sorry,

I saw your post the other day and did some testing on my test server. I could not duplicate you issue.

In my case I have magic_quotes_gpc turned on. My next test was to reconfigure PHP to turn magic_quotes_gpc off to mimic your installation. I got side tracked with other things. I'll try to get that done today. Smile

This issues has not come up before. So I'm convinced is a server/configuration conflict. It's as though were doing an extra escape when it is not needed. Almost like PHP is not tell us the truth about magic_quotes_gpc.

How about this, lets test my theory. In b2functions.php is the code:
Code:

function addslashes_gpc($gpc) {
    if (!get_magic_quotes_gpc()) {
        $gpc = addslashes($gpc);
    }
    return($gpc);
}

Lets change this to not do the addslashes call by commenting out the line:
Code:

function addslashes_gpc($gpc) {
    if (!get_magic_quotes_gpc()) {
 //       $gpc = addslashes($gpc);
    }
    return($gpc);
}


Try that and lets see if the double single quotes goes away. You will need to do a new post to test the theory. The old ones will need to be edited.

Kind regards,
michael e
Back to top
View user's profile Send private message Send e-mail
macshack



Joined: 17 Jul 2002
Posts: 1204
Location: Phoenix, Az

PostPosted: Fri Jan 24, 2003 7:43 pm    Post subject: Reply with quote

tsalzer,

Well stuff it in my nose.... Forget everything I said above. (The above test/change is not going to fix it)

I can not duplicate this issue. I even forced the condition that I described above and still no double single quotes.

Could I ask you to look at the entry in the db as see what is there and how it is escaped (or not). phpMyAdmin would allow you to see the data as it is on the db.

I'll keep trying to think of what may be going on.

michael e

I haven't given up yet. -- Might need to ask you to put a little debug code in to see if we can find where things are going yuck if you're willing.
Back to top
View user's profile Send private message Send e-mail
tsalzer



Joined: 23 Jan 2003
Posts: 5
Location: Washington

PostPosted: Sat Jan 25, 2003 1:28 am    Post subject: Reply with quote

I'm sure it must be a config problem on my end if it hasn't been reported before.

And I'm willing to fiddle/debug. I can always delete it all and reinstall, but I've done that once already.

Here's a snippet from the b2posts table as displayed by phpMyAdmin:
Code:
<br />
I don''''''''''''''''''''''''''''''''t know if that will resolve rsync problems I''''''''''''''''''''''''''''''''ve been struggling with, but I''''''''''''''''''''''''''''''''m hopeful. <br />
<br />


The above is the result of several edits. With the first posting, I get one apostrophe. Whenever the post is edited, it is essentially reposted, and then I get two apostrophes, then four, then eight...

Tom
Back to top
View user's profile Send private message
macshack



Joined: 17 Jul 2002
Posts: 1204
Location: Phoenix, Az

PostPosted: Sat Jan 25, 2003 1:47 am    Post subject: Reply with quote

Tom,

To make sure I understand.=: if you make a new post with an ' it get to the database as just one ' and you see only one if you view the blog. Correct?

Now if you edit that entry, to add a word or something, then we get two ' and each edit doubles the 's. correct?

That I did not test, but I will now.....

michael
Back to top
View user's profile Send private message Send e-mail
macshack



Joined: 17 Jul 2002
Posts: 1204
Location: Phoenix, Az

PostPosted: Sat Jan 25, 2003 2:42 am    Post subject: Reply with quote

Tom,

I would like you to try the following:

Create (or add to an existing) .htaccess file this code:
Code:

# this will make register globals off in b2's directory
# force magic_quotes_gpc, magic_quotes_runtime, magic_quotes_sybase off
# this is for a sigle quote escape issue
# just put a '#' sign before these three lines if you don't want that

<IfModule mod_php4.c>
    php_flag register_globals off
    php_value magic_quotes_gpc 0
    php_value magic_quotes_runtime 0
    php_value magic_quotes_sybase 0
</IfModule>


Then try you test again.

Michael e
[edit] This file goes in the same directory as your b2 files.
Back to top
View user's profile Send private message Send e-mail
tsalzer



Joined: 23 Jan 2003
Posts: 5
Location: Washington

PostPosted: Sat Jan 25, 2003 3:38 am    Post subject: Reply with quote

The .htaccess file did the trick Cool

I had tried a couple of the settings you suggested, but they had not worked.

I edited all posts that had duplicated apostrophes, saved them, and viewed the page. After deleting my browser cache, the new page showed up just fine. I then re-edited one of the posts, saved, and the new page was still correct.

FWIW: My server is a Sun Cobalt RaQ XTR running a highly modified (by Sun Cobalt) Linux 2.2 kernel. The PHP install comes with the unit, and I haven't tweaked the standard PHP install.

Thank you very much for the great help. How can I return the favor?

Tom
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> PHP help All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group