Hey folks,
Running SMF 2.0.19 with php 7.3. I uploaded the fix_packages.php file to the forum main directory, but when I try to direct my browser to the file, I get nothing.
My server guy is finding this error:
[Fri May 17 18:22:33.972433 2024] [php7:error] [pid 950855] [client 107.190.6.169:61313] PHP Parse error: syntax error, unexpected 'bool' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /var/www/html/forum/fix_packages.php on line 90
Anyone have any ideas as to what's going on?
IIRC, fix_packages.php is broken and needs to be fixed. Oddly, old versions that worked in 2.0.19 no longer work. ???
Quote from: Sir Osis of Liver on May 17, 2024, 09:09:40 PMIIRC, fix_packages.php is broken and needs to be fixed. Oddly, old versions that worked in 2.0.19 no longer work. ???
Ok, at least I'm not losing my mind!
Make sure you have the current version of fix_packages.php. It had a bit of an overhaul a few months ago. There are no known bugs at this time, all outstanding issues at that time were cleaned up. (Issues would be visible here: https://github.com/SimpleMachines/tools/issues)
I just tried & had no issues with:
- SMF 2.0.19 - PHP 7.4, PHP 8.0
- SMF 2.1.4 - PHP 7.4, PHP 8.0-8.3
I don't have a PHP 7.3 to test with. It's quite old, & has been out of support for a couple years.
The current version is here:
https://download.simplemachines.org/index.php?tools
It won't work on 7.3 because protected bool as a typed property declaration isn't supported until 7.4.
Easy to verify, copy/paste the content into 3v4l and run it on the last 7.3 version to see it dies with a parse error.
OK, I loaded PHP 7.3 and can see the problem. I logged it here:
https://github.com/SimpleMachines/tools/issues/75
Allowing class type declarations was added to PHP in 7.4, and there is a class type declaration on that line.
First recommendation is to upgrade to PHP 8.0.
If you cannot do that for some reason, I believe all you need to do is change the 'private bool' to 'private' on line 90. Worth a try.
And then upgrade to PHP 8.0.
Thanks for your insights, folks. I'll update to PHP 8.0 and let you know how it goes!
Upgraded to PHP 8.0, but the file did not work.
Then changed the 'private bool' to 'private' on line 90.
Worked like a charm!
Thanks to everyone for the help!