Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Gus A on May 17, 2024, 06:37:25 PM

Title: fix_packages.php file does not seem to be working
Post by: Gus A on May 17, 2024, 06:37:25 PM
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?
Title: Re: fix_packages.php file does not seem to be working
Post by: Sir Osis of Liver on May 17, 2024, 09:09:40 PM
IIRC, fix_packages.php is broken and needs to be fixed.  Oddly, old versions that worked in 2.0.19 no longer work. ???
Title: Re: fix_packages.php file does not seem to be working
Post by: Gus A on May 18, 2024, 06:22:26 AM
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!

Title: Re: fix_packages.php file does not seem to be working
Post by: shawnb61 on May 18, 2024, 02:50:46 PM
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
Title: Re: fix_packages.php file does not seem to be working
Post by: Arantor on May 18, 2024, 03:18:21 PM
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.
Title: Re: fix_packages.php file does not seem to be working
Post by: shawnb61 on May 18, 2024, 03:28:33 PM
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.
Title: Re: fix_packages.php file does not seem to be working
Post by: Gus A on May 19, 2024, 08:10:38 AM
Thanks for your insights, folks. I'll update to PHP 8.0 and let you know how it goes! 
Title: Re: fix_packages.php file does not seem to be working
Post by: Gus A on May 20, 2024, 03:03:25 PM
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!