WebDev

SMF Modifications => Releases & Version Updates => Topic started by: Chen Zhen on May 17, 2018, 11:37:29 pm

Title: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.3
Post by: Chen Zhen on May 17, 2018, 11:37:29 pm
SMF 2.0 - Enable PHP7.2+ Compatibility version 1.3
Version 1.3 released June 20/2018.

This update includes many more code changes to facilitate PHP 7.2+ compatibility.

Still pending:
Changes to ../Sources/Subs-Db-sqlite.php to replace sqlite_create_function with modern standard.
ie. PDO::sqliteCreateFunction or SQLite3::createFunction





Please uninstall and delete any previous versions prior to using this version.
Report any issues with this modification in this thread.

Enjoy.


Available to members only.

DOWNLOAD MODIFICATION (https://web-develop.ca/index.php?action=downloads;area=stable_smf_modifications;file=48)
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.2
Post by: demlak on June 19, 2018, 10:38:20 am
Hi,
i'm not 100% sure if this is php7.2 related (but web research hints me in this direction). When taking a look into personal Messages there are some errors about a count-function.

2: count(): Parameter must be an array or an object that implements Countable
File: ..../Sources/PersonalMessage.php

Line: 1036
Line: 967

thx in advance
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.3
Post by: Chen Zhen on June 20, 2018, 11:49:58 am
Yes the behavior of count() has changed in PHP 7.2

I implemented the changes and released a version 1.3 which you can download.
Make sure to uninstall & delete the older mod package prior to installing the new version.
Thanks for the report.
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.3
Post by: demlak on June 20, 2018, 09:09:56 pm
Thx a lot.. this was fast =)
it's working.

if you want to scare yourself.. grep for "count\(" over smf and all subfolders =)
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.3
Post by: Chen Zhen on June 21, 2018, 10:50:02 am

No problem.

Quoteif you want to scare yourself.. grep for "count\(" over smf and all subfolders =)

grep? You seem to be suggesting regex to return an array that is countable.
Why not explain this statement to be clear?
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.3
Post by: demlak on June 21, 2018, 06:05:05 pm
i just wanted to say, that the count() function is used maaaaany many times in SMF and Simple-Portal
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.3
Post by: Chen Zhen on June 22, 2018, 06:54:38 pm

Normally a developer will ensure the object or array being counted is actually declared prior to counting it.
It looks like a previous developer of SMF in that particular file relied on the older behavior of count() to return 1 when not an array/object or 0 on a null object/array.
I haven't seen the warning pop up as of yet other than this example however if it does happen again then report it and I will add the edit.

As for Simple Portal, I can't say for sure but I think Sinan would have made sure objects/arrays are declared prior to counting them.
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.3
Post by: streetskater on October 23, 2018, 09:05:31 pm
Please excuse me, I'm a little confused and this is my first time on this forum.
From the Download section I got a mod callled "SMF 2.0.X branch".  That appeared to be a Patching tool that would attempt to alter existing PHP 7.2 depreciated functions calls...  It seem it would try to modify my installed  SFM 2.0.15. and not roll me back to SMF 2.0

What is offered here is something different, YES?  This lookes like a modified version of SMF 2.0 compliant with 7.2 to replace any existing installed version of SMF, presumably a version earlier than 2.0.
BOTH are designated release 1.3

If what I downloaded is indeed a completly differnt "patch file"  Where is the appropriate place for me to ask about how to deploy it.  I didn't find related posts in the forum unless this is it.   I'm not a total novice with SFM--been using it for quite awhile but just getting back into it again.  It's been some time since I got very deep into the scripts.  Aeva Media 2.10 is giving me headaches, but that's another sob story :-) For the 2.0.X Branch  patch do I just upload it with Package Manager and and somehow run it, or it runs itself---doens't seem quite right but I'm not sure how else to install and run it.

Hopefully I'll be a little less newbie soon.
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.3
Post by: Chen Zhen on October 23, 2018, 09:57:53 pm

"SMF 2.0.X branch" is just to differentiate between the two current branches available since many now use the SMF 2.1 (or SMF 2.1.X) branch.
I did not test the patch on SMF versions previous to SMF 2.0.14 and have tested it on the current version 2.0.15 with no issues.

It does a lot of extensive file edits.
There is a possibility that it may not install without flagged parsing errors only if a modification has already altered the concerned files in the same area it attempts to edit.

Imo the areas in files it edits are not common places for other mods to have previously parsed given the current SMF hook structure.
Therefore it is likely you can install it without any parsing errors and no worries.

However, if you do encounter a parsing error during installation & are not comfortable with parsing your own edits then you can back out of the install without proceeding as with any other modification.

Try it out and if it shows everything as ok (no parsing errors) then install it.

 

Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.3
Post by: Skhilled on November 10, 2018, 03:57:29 am
Hi streetskater. Aeva media has been outdated and unsupported for about 5 years, more or less. There's been a number of changes to SMF's coding since then. It was a very good mod. I've used it myself for a number of years but gave up on it cause it was too outdated. That's what hackers look for...outdated software.
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.3
Post by: Skhilled on August 27, 2019, 10:35:18 am
Just finally tested this. So far, no errors! YEAH!

However, this should be added to the docs or something similar:

"When you switch versions of PHP you will get "Service Unavailable" upon viewing your site which may last up to a few minutes depending on the speed of the server as well as your broadband. Refresh your browser after a minute or two and your site should load again and be much faster!"

A few of us had tested switching PHP versions lately without the mod and got that. You'll also get it after you install the mod. Someone reminded us about the mod but the one on vbGamer's site. But his is only for 2.1. I'll let them know about this one for 2.0.x.
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.3
Post by: Chen Zhen on August 27, 2019, 04:57:25 pm

Are you referring to SMF Hacks?
That is the same version for the SMF 2.0.X branch.

SMF 2.1 should not need this type of modification as it should already be compliant with PHP 7.
 
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.3
Post by: Skhilled on August 29, 2019, 07:14:08 am
Was referring to both versions about the addition. But...

The one at smfhacks says for 2.0, I was wrong. I was probably thinking of Block Proxy VPN On Registration mod which is for 2.1. And yes, 7.2 and 7.3 works great with 2.1.
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.3
Post by: Chen Zhen on August 29, 2019, 04:52:04 pm

Did you say you are still using CentOS 6 ?
 

FYI PHP 7.4 is scheduled to roll out some time in November 2019.
The newer syntax for anonymous functions is very favorable for developers.
It involves a more short hand command structure.
Previous syntax should still work for it though.
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.3
Post by: Chen Zhen on August 30, 2019, 08:29:55 pm

If you are using CentOS, you should be able to follow the instructions from this link:
https://web-develop.ca/index.php?topic=446.0;moderate
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.3
Post by: Skhilled on August 31, 2019, 03:27:39 am
I sure am, thanks! :)
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.3
Post by: Chen Zhen on August 31, 2019, 10:24:12 am

No problem.

I updated that thread with one instruction I forgot to initially include.
The actual downloading of the kernel update.. oops.
It is edited now to include that command.
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.3
Post by: rty42 on November 06, 2019, 09:28:06 am
Hi!

I have tried to apply this MOD to my forums, but the big replacement block in subs.php fails to apply automatically (as I have BBC adding plugin).
Would you consider breaking up that big block to single create_function -> anon function replacements?
That way added bbc blocks would not prevent installation.

Of course added bbc blocks would not and could not be fixed by the MOD, but the original stuff would be corrected.
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.3
Post by: Chen Zhen on November 06, 2019, 11:06:31 pm
Doing it that way will be a lot of work.
There are many lines to be edited and it was easier to do them in bulk.

How many bbc mods have you added?
If it is few, would you consider using one of the custom bbc mods to add them instead?
Custom bbc or personalized bbc will allow you to add bbcodes.
Since they both use hooks to add them, this will not effect the parsing of the Subs.php file.
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.3
Post by: rty42 on November 07, 2019, 08:25:00 am
It's only a single youtube MOD per site, but for historical reasons it's two different youtube MODs on the two forums :(

I hoped it was easy to break up the block, but if it's complicated I'll give a try to a different approach.
EhPortal 1.24 © 2018, WebDev