miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Bugs miniBB Support Forums / Bugs /  
 

PHP Parse error with Mod Rewrite

 
Author Steve Shaw
Partaker
#1 | Posted: 31 Aug 2020 13:26 
As our server has Mod Rewrite capability, I decided to use the User-friendly-URLs for this update — but, I get this error in the error.log file, and a general HTTP ERROR 500 when trying to access the new forum.

PHP Parse error: syntax error, unexpected '[' in /XXX/XXX/XXX/XXX/addon_mod_rewrite_2.php on line 24

Any ideas?

Steve

Author Paul
Lead Developer 
#2 | Posted: 31 Aug 2020 16:07 
What PHP version do you have?

Maybe it comes from kind of abandoned option... or outdated version. I clearly see this syntax is still not abandoned in new PHP releases.

As of PHP 5.4 you can also use the short array syntax, which replaces array() with [].
I.e. it means these codes below should be equal in parsing, but obviously on your side they aren't (if the error is exactly about this line):

$array = array(
"foo" => "bar",
"bar" => "foo",
);

// as of PHP 5.4
$array = [
"foo" => "bar",
"bar" => "foo",
];
You could just try to update on the error line:

$replace = [
...
];
with this:

$replace = array(
...
);
(leave all internal codes intact on the '...' place).

Author Steve Shaw
Partaker
#3 | Posted: 1 Sep 2020 12:50 
PHP version: 7.3.6

I've gone back to the dynamic URLs for now.

Steve

Author Paul
Lead Developer 
#4 | Posted: 1 Sep 2020 13:05 
Steve Shaw:
PHP version: 7.3.6
The shortened array syntax definitely should work with this version.

Anyway, I've updated the add-on containing a default syntax now, you may try to test it on your side (I've also updated it on this forum, so I'm pretty sure it should work with a properly configured environment).

Bugs miniBB Support Forums / Bugs /
 PHP Parse error with Mod Rewrite
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Install the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑