Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preg_replace_callback(): Compilation failed: invalid range in character class #6282

Closed
ComsatArchitects opened this issue Apr 11, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@ComsatArchitects
Copy link

commented Apr 11, 2019

Describe the bug
Warning: preg_replace_callback(): Compilation failed: invalid range in character class at offset 18 in /home/***/public_html/components/com_kunena/views/topics/view.html.php on line 203

Might be from an unescaped "-" character in the regex?

To Reproduce
Showing up with the latest topics module enabled.
https://www.debuggex.com/r/4ZpBSGGal_BTjeNo

Expected behavior
"-" character should be escaped

Actual result
"-" is not escaped

Screenshots

System information (please complete the following information)

Joomla version: 3.9.x
Kunena version: 5.1.10.1
Php version: 7.2
Database version: MySQL

Desktop (please complete the following information):

  • OS: CentOS Linux
  • Browser: Chrome
  • Version: 73

Additional context
Might be able to fix by changing lines 203 and 212 to this (haven't been able to test yet):

$contents = preg_replace_callback('|\[K=(\w+)(?:\:([\w\-_]+))?\]|', array($this, 'fillTopicInfo'), $contents);

@ComsatArchitects

This comment has been minimized.

Copy link
Author

commented Apr 11, 2019

Changing the regex to this seems to pass? Needs testing

https://www.debuggex.com/r/cbjqVVRsXo9YBW-K

@810

This comment has been minimized.

Copy link
Member

commented Apr 12, 2019

i use a other site to test it, and there it was correct:

https://regex101.com/r/IS0DkD/1

ps there was a error, i need to add \ before it.

810 added a commit that referenced this issue Apr 12, 2019

@810

This comment has been minimized.

Copy link
Member

commented Apr 12, 2019

please try the nightly build. its on our download page on the bottom.

@810 810 added 5.1 bug labels Apr 20, 2019

@810 810 added this to the 5.1.11 milestone Apr 20, 2019

@810 810 closed this Apr 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.