strange bug when creating a bbcode with the {URL} token

Get help developing custom BBCodes or request one.
Post Reply
User avatar
M.O.B.
Registered User
Posts: 898
Joined: Tue Jan 04, 2005 1:07 am
Location: San Diego CA USA
Contact:

strange bug when creating a bbcode with the {URL} token

Post by M.O.B. » Thu Mar 08, 2018 11:31 pm

While editing an old bbcode that I created that had the {URL} token, I stumbled on a bug after I updated it.

After several hours, I found the issue, and I was able to fix it, but it's a strange one. Because I can duplicate the bug even when creating a new bbcode with the {URL} token in it. So it's not a case of a bad edit of an old bbcode.

Here is my info, so you know what I am working with:

Code: Select all

phpBB 3.1.12
PHP: 5.6.34
MySQL: 5.5.58-cll
Advanced BBCode Box 3 Extension  v3.14
So in order to duplicate the bug on phpBB 3.1.12 you need to either edit an old BBCODE you created that has the {URL} token (and then save your changes -- you don't need to edit anything) or create a new one with the {URL} token.

STEP 1:
Go ahead and create the following test BBCODE:

BBCode usage
[test]{URL}[/test]

HTML replacement

Code: Select all

Just a simple test: <a href="{URL}" class="postlink">Click Here</a>.
Help line
Just a test.

STEP 2:
Now go to your forum and try to create a post or reply with the above bbcode you created.

It should look like this in your post box:

Code: Select all

[test]https://www.phpbb.com[/test]
** or whatever URL you decided to put inside that bbcode.

DO NOT SUBMIT, instead press PREVIEW.

You will see two things:

1) you will see the following errors on the very top of your phpBB board:

Code: Select all

[phpBB Debug] PHP Warning: in file [ROOT]/includes/message_parser.php on line 84: preg_match(): Compilation failed: unrecognized character after (?< at offset 39
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5348: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3937)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5348: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3937)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5348: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3937)
2) And you will see that the bbcode on your post did not do what you wanted it to do.

It will look like this:

Code: Select all

[test]https://www.phpbb.com[/test]
Plus if you remove that from your text box, and test either the quote bbcode or any other bbcode, you will see those errors still show above your phpBB board.

So it seems that it also affects all the rest of the bbcodes -- you don't even need to use the one you just created, you will see those errors no matter what you try when you press PREVIEW.

STEP 3:

The only way to remove those errors from showing on your header is:

1) delete the bbcode from the ACP that you just created or edited. That will fix it so those errors above don't show anymore.

2) or go into your mySQL database,
  1. find that bbcode under phpbb_bbcodes,
  2. find your bbcode that you created test,
  3. press the edit button for that bbcode
  4. and look inside these two boxes: first_pass_match and second_pass_match
  5. and find and replace the following strange code: (?<\!javascript)
  6. Save your changes and you can now use that bbcode without any issues.
I guess instead of going into your mySQL database and delete that code within those two boxes above, you can run this SQL Query:

Code: Select all

update phpbb_bbcodes set first_pass_match = replace(first_pass_match, '(?<\!javascript)', '');
update phpbb_bbcodes set second_pass_match = replace(second_pass_match, '(?<\!javascript)', '');
CONCLUSION:
So I guess, for some odd reason, that strange code is being added to the database: (?<\!javascript) -- and that is the problem!

FYI: I tested this issue with several phpBB 3.1.x boards I have, and I can duplicate this issue on my server.

Plus I tested this issue with a test phpBB 3.2.x board that I have on the same server, and no issues with that version. So I suspect it may be just phpBB 3.1.x issue?

Let me know if you have any further questions or things you want me to try??

NOTE: I had originally posted this bug in this section, but was told by the developer that I should post it in the main forum. I figure, the bbcode section should be the place? :)
Image

User avatar
thevisionisdivine
Registered User
Posts: 141
Joined: Tue Mar 10, 2015 3:36 pm
Name: Bruno Bianco

Re: strange bug when creating a bbcode with the {URL} token

Post by thevisionisdivine » Tue Apr 24, 2018 11:27 pm

This problem has some realtionship with URL... maybe.
But I get the same error when I modify a forum description and save it.
The message is always:

Code: Select all

[phpBB Debug] PHP Warning: in file [ROOT]/includes/message_parser.php on line 84: preg_match(): Compilation failed: unrecognized character after (?< at offset 38
[phpBB Debug] PHP Warning: in file [ROOT]/includes/message_parser.php on line 84: preg_match(): Compilation failed: unrecognized character after (?< at offset 54
[phpBB Debug] PHP Warning: in file [ROOT]/includes/message_parser.php on line 84: preg_match(): Compilation failed: unrecognized character after (?< at offset 35
Now?
* * * All To Be The Master Of The Wind * * *

alexlupoz
Registered User
Posts: 3
Joined: Sat Feb 24, 2018 9:08 pm

Re: strange bug when creating a bbcode with the {URL} token

Post by alexlupoz » Thu May 10, 2018 6:57 am

I was having many problems to display the user name, so I decided to put JavaScript. Take a look at my post viewtopic.php?f=438&t=2471416

basically, you will use JavaScript to get the value saved in an HTML tag with style "display: none;".

FDMK
Registered User
Posts: 3
Joined: Mon May 14, 2018 6:43 pm

Re: strange bug when creating a bbcode with the {URL} token

Post by FDMK » Mon May 14, 2018 6:47 pm

I can confirm this bug. I was trying to add a thumbnail bbCode, and I was getting the errors described above. I removed the javascript part as suggested, and it works perfectly now.

Post Reply

Return to “Custom BBCode Development and Requests”

Who is online

Users browsing this forum: No registered users and 7 guests