Broken code tag?

We know you have an opinion on how things should be run around here. These are suggestions for the forums, and the website.This forum is not a place to ask for suggestions to your own coding (or otherwise) problems.

Moderator: General Moderators

Post Reply
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Broken code tag?

Post by JAM »

viewtopic.php?f=1&t=78010&p=439570#p439570
I'm guessing I'm not the only one that spots the problem? 8O
Edit 1: Also, the code=php and php tags seems to automaticly add \r\n's while editing posts sometimes.
Edit 2: Especially when choosing to edit you own post. A new \r\n is added...

Test code=text:

Code: Select all

$foo = 'A variable with a single thing here: ' by JAM';
Test code=php:

Code: Select all

$foo = 'A variable with a single thing here: ' by JAM';
 
Test php:

Code: Select all

$foo = 'A variable with a single thing here: ' by JAM';
 
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Broken code tag?

Post by Chris Corbyn »

Hmmm... interesting. Unfortunately I suspect this is a GeSHi bug and not a bug with the BBCode itself.

Thanks for the heads up, we'll do some digging.

Code: Select all

$test = 'there\'s a quote in here';

Code: Select all

$test = 'there\'s a quote in here';

Code: Select all

$test = 'there\'s a quote in here';
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Re: Broken code tag?

Post by JAM »

No, didn't think so either. I've modded phpbb3 for some o' months now and never had these issues myself, even after adding hombrew bbcode java/php/sql/aso snippets.
I do know however that the phpbb2-phptag-version of phpdn was 'slightly' (understatment of the year?) edited so I just thought that it were a phpbb3 version aswell somewhere. :D

Good luck tho! I'm sure it's a simple stupid thingy...
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Broken code tag?

Post by Chris Corbyn »

I reckon the guy who wrote the bbGeSHi mod has magic_quotes turned on and has blindly used stripslashes() somewhere.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: Broken code tag?

Post by RobertGonzalez »

You know what? I am almost certain that it does. I was using a WordPress GeSHi plugin that required addslashes in order to post PHP code correctly. I think you are right Chris.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: Broken code tag?

Post by Kieran Huggins »

has trouble with setting constants as well - I posted a class in the SwiftMailer forum and had to comment them out :-(

Not a big deal, just reporting!
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Re: Broken code tag?

Post by Ollie Saunders »

With smilies disabled:

Code: Select all

foo(.8);
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Re: Broken code tag?

Post by Ollie Saunders »

With smilies enabled:

Code: Select all

foo(.<!-- s8) --><img src=\"{SMILIES_PATH}/icon_cool.gif\" alt=\"8)\" title=\"Cool\" /><!-- s8) -->;
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Broken code tag?

Post by Weirdan »

ole wrote:With smilies disabled:

Code: Select all

foo(.8);
 
Ok, I see. I will bring this issue to light in moderator forums.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Re: Broken code tag?

Post by JAM »

Also, this code while editing...
Image
...gives you this behavior. Not a biggie, but very annoying. Notice the first row of code, and missing space char?

Code: Select all

   $counter = count($questions);
    for ($i = 0; $i < $counter; $i++) {
        // more code

Code: Select all

 
    $counter = count($questions);
    for ($i = 0; $i < $counter; $i++) {
        // more code
User avatar
Verminox
Forum Contributor
Posts: 101
Joined: Sun May 07, 2006 5:19 am

Re: Broken code tag?

Post by Verminox »

^^ That does not look like a bug. That's something I'd expect, because you have 3 spaces before the first line there, not 4. Also, in the second code block you entered a newline after the [ code ] tag, so it showed up empty. I usually put the <?php ?> tags alongside the [ code ] blocks

Code: Select all

<?php
$var = 'value';
?>
Gives best results:

Code: Select all

<?php
$var = 'value';
?>
Post Reply