Advertisement:

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

Offline spiros

  • Language Moderator
  • SMF Hero
  • *
  • Posts: 1,670
  • 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: 69,667
    • StoryBB/StoryBB 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.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Sh@mbles

  • SMF Hero
  • ******
  • Posts: 4,968
  • 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: 69,667
    • StoryBB/StoryBB 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.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Chen Zhen

  • Sophist Member
  • *****
  • Posts: 1,150
  • 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.

My SMF Mods & Plug-Ins

WebDev
Simple Portal Support

Request politely & demand nothing.

Online vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 20,646
    • 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: 69,667
    • StoryBB/StoryBB 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.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Online vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 20,646
    • 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

Offline spiros

  • Language Moderator
  • SMF Hero
  • *
  • Posts: 1,670
  • Gender: Male
  • A different point of view
    • spiros.doikas on Facebook
    • doikas on LinkedIn
    • @greektranslator on Twitter
    • Greek Translation
Re: Has anyone tested PHP 7.2?
« Reply #8 on: May 16, 2018, 03:03:51 PM »
Just tested with php 7.2.5, I see no errors on actual pages
https://www.translatum.gr/forum/index.php

on error log plenty of depreciated ones:

Code: [Select]
8192: Function create_function() is deprecated
/public_html/forum/Sources/Subs.php
Line: 1509

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 57,386
  • Gender: Male
    • Kindred-999 on GitHub
Re: Has anyone tested PHP 7.2?
« Reply #9 on: May 16, 2018, 04:59:16 PM »
Well, SMF 2.0.15 does not officially support 7.2
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.