Advertisement:

Author Topic: Has anyone tested PHP 7.2?  (Read 389 times)

Offline spiros

  • Language Moderator
  • SMF Hero
  • *
  • Posts: 1,609
  • Gender: Male
  • A different point of view
    • spiros.doikas on Facebook
    • doikas on LinkedIn
    • @greektranslator on Twitter
    • Greek Translation
Has anyone tested PHP 7.2?
« on: January 02, 2018, 02:05:45 PM »
Has anyone tested PHP 7.2 on SMF?

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,361
    • Arantor on GitHub
Re: Has anyone tested PHP 7.2?
« Reply #1 on: January 02, 2018, 02:16:33 PM »
No. But I can tell you without any hesitation that it will start vomiting masses of deprecated errors everywhere.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline Shambles

  • SMF Hero
  • ******
  • Posts: 4,659
  • Gender: Male
    • i30 Owners Club
Re: Has anyone tested PHP 7.2?
« Reply #2 on: January 02, 2018, 05:15:13 PM »
Quote from: Arantor
... I can tell you without any hesitation that it will start vomiting masses of deprecated errors everywhere.

You're not kidding.

Quote
Function create_function() is deprecated
by the trillion.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,361
    • Arantor on GitHub
Re: Has anyone tested PHP 7.2?
« Reply #3 on: January 02, 2018, 05:17:07 PM »
Yup, every single bbcode definition will cause errors. Probably multiple times per invocation of bbcode parser.

This was fixed in 2.1 but is borderline impossible to properly fix on 2.0 and every 2.0 bbcode.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline Chen Zhen

  • Sophist Member
  • *****
  • Posts: 1,053
  • Gender: Male
  • If you're going through hell, keep going!
    • Underdog-01 on GitHub
    • WebDev.ca
Re: Has anyone tested PHP 7.2?
« Reply #4 on: January 02, 2018, 05:32:03 PM »

You can suppress the deprecated warning for PHP 7.2 specifically.

add to function: error_handler()
Code: [Select]
// Disable PHP 7.2 "Function create_function() is deprecated"  errors from filling the forum error logs
if (defined('E_DEPRECATED') && $error_level == E_DEPRECATED && phpversion() == '7.2.0' && strpos($error_string, 'Function create_function() is deprecated') !== false)
return;

.. this will work fine for PHP 7.2 but the deprecated warning means in an upcoming version of PHP it will be removed altogether where this type of patch will not work.

Offline vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,741
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Has anyone tested PHP 7.2?
« Reply #5 on: January 02, 2018, 06:14:23 PM »
I like that trick! I did that for SMF 1.1.x and still runs on php 7.1
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,361
    • Arantor on GitHub
Re: Has anyone tested PHP 7.2?
« Reply #6 on: January 02, 2018, 06:50:17 PM »

You can suppress the deprecated warning for PHP 7.2 specifically.

add to function: error_handler()
Code: [Select]
// Disable PHP 7.2 "Function create_function() is deprecated"  errors from filling the forum error logs
if (defined('E_DEPRECATED') && $error_level == E_DEPRECATED && phpversion() == '7.2.0' && strpos($error_string, 'Function create_function() is deprecated') !== false)
return;

.. this will work fine for PHP 7.2 but the deprecated warning means in an upcoming version of PHP it will be removed altogether where this type of patch will not work.


You really shouldn't do a version comparison like that because when 7.2.1 comes out, it's not going to work... you could turn it into a version_compare() call instead and check for 7.2 or above all at once.

As for SMF 1.1 still working on PHP 7, writing a shim for the mysql_ functions, followed by replacing out all of the preg_replace with /e calls (which don't work in 7), along with all the other changes you're going to need to do, you might as well put the time in upgrading to 2.0 anyway because you're only going to spend more and more time patching up such issues.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,741
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Has anyone tested PHP 7.2?
« Reply #7 on: January 02, 2018, 09:13:09 PM »
I agree the comparison should be changed.. I am still waiting out for a few releases for 7.2 to come before i actually look to move to it for my non smf projects. For more SMF projects I most use SMF 2.0 except for legacy forum hosting where I still have many forums. waiting for 2.1 to make that big jump
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro