Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: V@no on November 25, 2010, 11:21:10 AM

Title: BBCode inside [PHP]...[/PHP] block
Post by: V@no on November 25, 2010, 11:21:10 AM
Hello.
It seems [php][/php] and [code][/code] don't share the same restrictions:

When used [php]:

$var = "[URL=http://".$url."]".$name."[/URL]";

When used [code]:
$var = "[URL=".$url."]".$name."[/URL]";

In [php] was added http:// by SMF
Is it a bug?

I thought both [php] and [code] were supposed to prohibit using of BBCODE inside and treat it as simple text instead.

P.S.
whatever it is, evidently it affects both 1.x and 2.x versions.
Title: Re: BBCode inside [PHP]...[/PHP] block
Post by: Oldiesmann on November 25, 2010, 12:08:02 PM
Yes, that's a bug...

There are two ways around that.

Option 1 - use the HTML entity for one of the brackets (&# 91; for [ and &# 93; for ], but without the spaces). The only problem with this is that they will get parsed as soon as you post, and you'll have to change them back if you quote it/edit it.

Option 2 - just put it in a code box with a PHP tag before the code:

<?php
$var
="[URL=".$url."]".$name."[/URL]";
Title: Re: BBCode inside [PHP]...[/PHP] block
Post by: V@no on December 04, 2010, 10:29:42 PM
Is there a more "practical" fix?
Title: Re: BBCode inside [PHP]...[/PHP] block
Post by: Kindred on December 07, 2010, 12:23:34 PM
wait for the bug fix in 2.0 final?   (moving this to bug reports since it seems to happen here on 2.0RC4)

originally reported on 1.1.x
Title: Re: BBCode inside [PHP]...[/PHP] block
Post by: emanuele on November 20, 2011, 05:16:58 PM
Not fixed in 2.0.

I think I've read some discussion about it, but I don't remember where but I can't find it tracked.
Title: Re: BBCode inside [PHP]...[/PHP] block
Post by: Arantor on December 25, 2013, 09:05:05 PM
The most practical fix is to actually treat php tags as code tags during the preparse stage but that has all kinds of awkward edge conditions.