Current time: 04-17-2014, 12:57 PM Hello There, Guest! (LoginRegister)


 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[F] A bug, and a solution
04-28-2007, 02:10 AM (This post was last modified: 04-28-2007 04:49 PM by Macai.)
Post: #1
[F] A bug, and a solution
I've found and exterminated a small bug.

Someone noticed before that if you enter
Code:
\"
into any setting, it will create a syntax error in inc/settings.php. This person fixed the bug by adding a line of code. However, the same syntax error is produced if you enter
Code:
\\"
as well. In fact, this syntax error can be reproduced by entering any number of those \, and then a ". So, I decided that to resolve this once and for all, regular expressions would be worth using.

The MyBB guys may use this code anywhere they like.

EDIT: I updated the fix to use preg_replace() as opposed to ereg_replace().

If anyone has any trouble with this fix, post it here.


Attached File(s)
.txt  mybb_bug_patch_2.0.txt (Size: 991 bytes / Downloads: 201)

--Macai

Join the Dragon's Eye Guild! http://dragonseyeguild.net
Visit this user's website Find all posts by this user
04-28-2007, 05:31 AM
Post: #2
RE: A bug, and a solution
And why wouldn't $setting['value'] = str_replace("\"", "\\\"", $setting['value']); work in the first place? It's completely correct code
Visit this user's website Find all posts by this user
04-28-2007, 07:39 AM
Post: #3
RE: A bug, and a solution
ask not why it doesn't work, but what code does work Wink

there is no spoon or something Toungue
Find all posts by this user
04-28-2007, 01:44 PM (This post was last modified: 04-28-2007 02:06 PM by Macai.)
Post: #4
RE: A bug, and a solution
The code does not work, Tikitiki. I explained how to reproduce the error--by entering \\", or \\\" as opposed to \".

EDIT: The old bug fix only stops \" from causing the error. That's what's wrong. \\", \\\" and any number of \ immediately before the " will still produce the error, so I wrote code that will resolve the issue for that pattern.

--Macai

Join the Dragon's Eye Guild! http://dragonseyeguild.net
Visit this user's website Find all posts by this user
04-28-2007, 02:24 PM
Post: #5
RE: A bug, and a solution
Ah yes indeed. I think I had too much root beer last night! I guess I toasted my birthday one too many times Big Grin


btw, I got an ipod nano silver 2 GB, and I have 185$ enough to buy vista pro! woo!
Visit this user's website Find all posts by this user
04-28-2007, 02:30 PM
Post: #6
RE: A bug, and a solution
Tikitiki Wrote:Ah yes indeed. I think I had too much root beer last night! I guess I toasted my birthday one too many times Big Grin


btw, I got an ipod nano silver 2 GB, and I have 185$ enough to buy vista pro! woo!
Woot! That's cool. I wish I weren't so poor, so I could get something like that.

But yeah, is there a process for getting this patch official? I'd like to see a more functional MyBB.

--Macai

Join the Dragon's Eye Guild! http://dragonseyeguild.net
Visit this user's website Find all posts by this user
04-28-2007, 02:45 PM
Post: #7
RE: A bug, and a solution
I've replaced it in the svn code! Marking as fixed Smile
Visit this user's website Find all posts by this user
04-28-2007, 02:45 PM
Post: #8
RE: [F] A bug, and a solution
This bug has been fixed in the latest code.

Please note the latest code is not live on the site or for download. An update will be released which contains this fix.
Visit this user's website Find all posts by this user
04-28-2007, 02:48 PM
Post: #9
RE: [F] A bug, and a solution
That's cool. Someone got to it before I did, then, eh?

--Macai

Join the Dragon's Eye Guild! http://dragonseyeguild.net
Visit this user's website Find all posts by this user
04-28-2007, 02:50 PM
Post: #10
RE: [F] A bug, and a solution
No, I used your patch

Also, are you sure $setting['value'] = ereg_replace("(\\\\*)\\\"","\\1\\1\\\"",$setting['value']); is right? Are you sure there is supposed to be two \\1 ?
Visit this user's website Find all posts by this user


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | MyBB | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication