Advertisement:

Author Topic: BBCode inside [PHP]...[/PHP] block  (Read 8714 times)

Offline V@no

  • Jr. Member
  • **
  • Posts: 118
  • mmm PHP...
BBCode inside [PHP]...[/PHP] block
« 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]:
Code: [Select]
$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.
« Last Edit: August 18, 2012, 07:57:09 AM by Trekkie101 »

Offline Oldiesmann

  • Developer
  • SMF Super Hero
  • *
  • Posts: 24,814
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • http://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: BBCode inside [PHP]...[/PHP] block
« Reply #1 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:

Code: [Select]
<?php
$var
="[URL=".$url."]".$name."[/URL]";
Michael Eshom
Webmaster / SMF Lead Developer
oldiesmann@simplemachines.org

Offline V@no

  • Jr. Member
  • **
  • Posts: 118
  • mmm PHP...
Re: BBCode inside [PHP]...[/PHP] block
« Reply #2 on: December 04, 2010, 10:29:42 PM »
Is there a more "practical" fix?

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 55,102
  • Gender: Male
    • Kindred-999 on GitHub
Re: BBCode inside [PHP]...[/PHP] block
« Reply #3 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
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Re: BBCode inside [PHP]...[/PHP] block
« Reply #4 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.


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non รจ una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,037
    • Arantor on GitHub
Re: BBCode inside [PHP]...[/PHP] block
« Reply #5 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.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.