Daily Lucky Numbers:
8
11
19
29
40
42

SMF 2.0 - Enable PHP7.2+ Compatibility version 1.3

Started by Chen Zhen, May 17, 2018, 11:37:29 PM

Previous topic - Next topic

Skhilled


Chen Zhen


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.

rty42

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.

Chen Zhen

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.

rty42

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.

Dankirk

Hey, the SMF 2.0.16 patch seems to have fixed the cases that cause errors on PHP 7.2+, but SMF still uses deprecated functions (like create_function) and only hides them from error logging. Not my idea of PHP 7.2 support :( ... Seems your mod is still relevant. :)

I went ahead and modified your mod files so it can be applied on top of SMF 2.0.16. You can find them in the attachment zip. There still might be new code in 2.0.16 (or 2.0.17) that introduces even more deprecated code, so those should be checked before going ahead with this. Not sure if you'd like this mod to re-enable error logging for deprecations, but if so, you can search for this line in the sources:

$ssi_error_reporting = error_reporting((defined('E_STRICT') ? E_ALL | E_STRICT : E_ALL) & ~E_DEPRECATED);






Dankirk

Can't seem to be able to edit my last post, but here's a list of things I did with mod files:

php72compat.xml

- Subs-Package.php
   - no longer needs each() fix
- Subs.php
   - replace fix: Added rel="noopener noreferrer" to generated bbc links
   - replace fix: Added some classes for bbc
   - replace fix: Use image proxy function
- ManageSettings.php
   - replace fix: Added new gdpr section (introducing even more create_function() usage)

php72compat2.xml
- ManageMaintenance.php
   - remove obsolete entity replacement
- Subs-Sound.php
   - no longer needs unpack() fix
- PersonalMessage.php
   - no longer needs count() fix

Chen Zhen


Welcome to Webdev, Dankirk.

The SMF devs probably thought it would be best to come up with a solution that would allow any installed mods to also circumvent the PHP warnings. 

For those that still want to have all occurrences of create_function omitted, I will work on an updated release for SMF 2.0.16+.
 

ManuDevil

Hello,

I'm sorry, but there is a 404 error when trying to download the PHP7.2+ compatibility mod for SMF 2.0.x.

Thanks anyway.

Chen Zhen

#24
Thanks for the report.
Version 1.4 was deleted in error at some point.

Version 1.5 is now available which will work for SMF 2.0.17 (or a few versions previous to that).

This thread has been locked.