2.0.15: [url] BBcode Bug

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Locked
Saint_hh
Registered User
Posts: 362
Joined: Thu Mar 31, 2005 5:16 pm
Location: Hamburg / Germany
Name: Kevin
Contact:

2.0.15: [url] BBcode Bug

Post by Saint_hh »

Hi there,

after updating to version 2.0.15 i recognized some kind of a little bug.

If i format a link without a break, it's displayed correctly

If i format a link with a break:
it's broken.



It's got something to do with this part of Codechanges (taken from the phpBB 2.0.14 to phpBB 2.0.15 Code Changes):

Code: Select all

# 
#-----[ OPEN ]--------------------------------------------- 
# 
includes/bbcode.php

#
#-----[ FIND ]---------------------------------------------
# Line 210
	// [url=xxxx://www.phpbb.com]phpBB[/url] code..
	$patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is";
	$replacements[] = $bbcode_tpl['url3'];

	// [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix).
	$patterns[] = "#\[url=((www|ftp)\.[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is";

#
#-----[ REPLACE WITH ]---------------------------------------------
# 
	// [url=xxxx://www.phpbb.com]phpBB[/url] code..
	$patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\]([^?].*?)\[/url\]#i";
	$replacements[] = $bbcode_tpl['url3'];

	// [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix).
	$patterns[] = "#\[url=((www|ftp)\.[^ \"\n\r\t<]*?)\]([^?].*?)\[/url\]#i";
Especially here:

Code: Select all

	$patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\]([^?].*?)\[/url\]#i";
Any ideas how to fix it, without taking the old codelines (with the old codeline the link functions with the break)?
Last edited by Saint_hh on Tue Jun 21, 2005 11:29 am, edited 1 time in total.
User avatar
CTCNetwork
Former Team Member
Posts: 15424
Joined: Fri Dec 19, 2003 3:50 am
Location: In that Volvo behind you!
Contact:

Post by CTCNetwork »

Hi,

As far as I know any links where you have a return in the text will not work.
Spaces are fine but not returns.

This has been true of versions from 2.0.6 - when I started using the software...

Hope this helps,

Des. . . :wink:
Density:- Not just a measurement~Its a whole way of Life.! ! !
| Welcome! | RTFM!!! | Search! It's Easy! | Problem? | Spam? | Advice! |
Saint_hh
Registered User
Posts: 362
Joined: Thu Mar 31, 2005 5:16 pm
Location: Hamburg / Germany
Name: Kevin
Contact:

Post by Saint_hh »

Sorry - i'm 100% sure that it has worked until the version 2.0.15
Check this - it's a 2.0.10 testing board.
And you can check it yourself, if you want to:

open includes/bbcode.php

find:

Code: Select all

$patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\]([^?].*?)\[/url\]#i"; 
replace with:

Code: Select all

$patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is"; 
Then you have the codeline of Version 2.0.14 and a link with a return in it works.

Greetz from Hamburg :D
User avatar
CTCNetwork
Former Team Member
Posts: 15424
Joined: Fri Dec 19, 2003 3:50 am
Location: In that Volvo behind you!
Contact:

Post by CTCNetwork »

Hi,

Having checked, some elements of BBCode may have been changed. It is now how things should be.

As I mentioned, links on my forums never worked where there was a return in the linked text..

Des. . . :wink:
Density:- Not just a measurement~Its a whole way of Life.! ! !
| Welcome! | RTFM!!! | Search! It's Easy! | Problem? | Spam? | Advice! |
Saint_hh
Registered User
Posts: 362
Joined: Thu Mar 31, 2005 5:16 pm
Location: Hamburg / Germany
Name: Kevin
Contact:

Post by Saint_hh »

Today i've deleted the old testing phpBB 2.0.10 and i've installed a pure phpBB 2.0.14 (just added the german language). Downloaded from phpbb.com
The result could be seen here. Try it yourself, it's oben for testingpurposes. A link with a <br> in it is displayed correctly.

CTCNetwork wrote: It is now how things should be.

That means that the only way to get it working the old way, is replacing the new by the old 2.0.14 codeline? How does it affect the security of the board?

Sorry for bothering you once again and for my poor english.

Regards,

Kevin
User avatar
Brenakie
Registered User
Posts: 77
Joined: Mon Mar 15, 2004 12:08 am
Location: Pascoag, RI - USA
Contact:

similar problem

Post by Brenakie »

Hi,

I'm kind of having a similar problem and hoping someone can help me out. When I go to insert a URL using the the following:
[ url=http://rideinri.com]click here[/url ] minus the spaces in the tags
I get nothing.

Also upgraded to 2.0.15

Tried the updating the bbcode.php, still nothing, reverted to the old code.

BB code is enabled on the site.

If I drop a URL with no tags it works fine.

Please visit the link to the test area below to see what I'm experienceing http://rideinri.com/forum/viewforum.php?f=68

Hope you can help, I'd like to get this resolved soon!

Thanks in advance for your time,

Bren
Saint_hh
Registered User
Posts: 362
Joined: Thu Mar 31, 2005 5:16 pm
Location: Hamburg / Germany
Name: Kevin
Contact:

Post by Saint_hh »

*up*
KI
Registered User
Posts: 32
Joined: Sat Nov 20, 2004 11:46 pm

Post by KI »

Saint_hh wrote: Sorry - i'm 100% sure that it has worked until the version 2.0.15
Check this - it's a 2.0.10 testing board.
And you can check it yourself, if you want to:

open includes/bbcode.php

find:

Code: Select all

$patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\]([^?].*?)\[/url\]#i"; 
replace with:

Code: Select all

$patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is"; 
Then you have the codeline of Version 2.0.14 and a link with a return in it works.

Greetz from Hamburg :D


Thanks for this info. :)
Saint_hh
Registered User
Posts: 362
Joined: Thu Mar 31, 2005 5:16 pm
Location: Hamburg / Germany
Name: Kevin
Contact:

Post by Saint_hh »

KI wrote: Thanks for this info. :)

You're welcome. :D

But i'm still interested in a statement of a developer or a PHP specialist, whow returning to the old Codeline is affecting the security of phpBB. Or, in best case, whow to get it working the old way without undermining the security.
There is for sure a interest of a few (or more) people.

Regards,

Saint
geocator
Registered User
Posts: 16242
Joined: Fri Jan 09, 2004 11:56 pm
Location: On dry land
Contact:

Post by geocator »

I am thinking that was the change to keep emtpy url from working.
Saint_hh
Registered User
Posts: 362
Joined: Thu Mar 31, 2005 5:16 pm
Location: Hamburg / Germany
Name: Kevin
Contact:

Post by Saint_hh »

Okay, now i've found the reason for this missing function. Thanks to Christian_W of phpbb.de for useful hints!

It all depends on the missing modifier S at the end of the new codeline:
http://www.php-resource.de/manual.php?p=pcre.pattern.modifiers wrote: s (PCRE_DOTALL)

If this modifier is set, a dot metacharacter in the pattern matches all characters, including newlines. Without it, newlines are excluded. This modifier is equivalent to Perl's /s modifier. A negative class such as [^a] always matches a newline character, independent of the setting of this modifier.


The function, to prevent empty url from working, is set in the middle of the codeline and has nothing to do with the modifier "S".

Code: Select all

([^?].*?) instead of  (.*?) 
In my opinion, the modifier has just been forgotten and don't affect the security of phpBB. Please correct me if this is wrong.


------------------------------------------------------------------
Okay, the fix for it looks like this:

open includes/bbcode.php

search for:

Code: Select all

$patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\]([^?].*?)\[/url\]#i";
replace with:

Code: Select all

$patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\]([^?].*?)\[/url\]#is";
Regards,

Saint
User avatar
Brenakie
Registered User
Posts: 77
Joined: Mon Mar 15, 2004 12:08 am
Location: Pascoag, RI - USA
Contact:

Re: similar problem

Post by Brenakie »

Brenakie wrote: Hi,

I'm kind of having a similar problem and hoping someone can help me out. When I go to insert a URL using the the following:
[ url=http://rideinri.com]click here[/url ] minus the spaces in the tags
I get nothing.

Also upgraded to 2.0.15

Tried the updating the bbcode.php, still nothing, reverted to the old code.

BB code is enabled on the site.

If I drop a URL with no tags it works fine.

Please visit the link to the test area below to see what I'm experienceing http://rideinri.com/forum/viewforum.php?f=68

Hope you can help, I'd like to get this resolved soon!

Thanks in advance for your time,

Bren


I just tried:
$patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\]([^?].*?)\[/url\]#is";

and no change any ideas????

Bren
Saint_hh
Registered User
Posts: 362
Joined: Thu Mar 31, 2005 5:16 pm
Location: Hamburg / Germany
Name: Kevin
Contact:

Post by Saint_hh »

CTCNetwork wrote: Hi,

Having checked, some elements of BBCode may have been changed. It is now how things should be.

As I mentioned, links on my forums never worked where there was a return in the linked text..

Des. . . :wink:


Thanks for checking it seriously. :wink:
phpBB 2.0.15 to phpBB 2.0.16 Code Changes wrote:
  • Url descriptions able to be wrapped over more than one line again

Code: Select all

# 
#-----[ OPEN ]--------------------------------------------- 
# 
includes/bbcode.php

#
#-----[ FIND ]---------------------------------------------
# Line 211
	$patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\]([^?].*?)\[/url\]#i";
	$replacements[] = $bbcode_tpl['url3'];
  
	// [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix).
	$patterns[] = "#\[url=((www|ftp)\.[^ \"\n\r\t<]*?)\]([^?].*?)\[/url\]#i";

#
#-----[ REPLACE WITH ]---------------------------------------------
# 
	$patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\]([^?\n\r\t].*?)\[/url\]#is";
	$replacements[] = $bbcode_tpl['url3'];

	// [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix).
	$patterns[] = "#\[url=((www|ftp)\.[^ \"\n\r\t<]*?)\]([^?\n\r\t].*?)\[/url\]#is";



Regards,

Saint
Locked

Return to “2.0.x Support Forum”