Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: La_Lafayette on December 06, 2018, 01:05:57 AM

Title: How to resolve deprecated error?
Post by: La_Lafayette on December 06, 2018, 01:05:57 AM
https://i.gyazo.com/68feeb1db8724c8ba89ab7b4504a1cd0.png


I'm at a loss with this error

using SMF 2.0.15
Title: Re: How to resolve deprecated error?
Post by: Aleksi "Lex" Kilpinen on December 06, 2018, 01:15:26 AM
SMF 2.0.15 only supports up to PHP 7.1 as PHP 7.2 is deprecating create_function() and this is used by the BBCode parser.

See discussion from this post on https://www.simplemachines.org/community/index.php?topic=558072.msg3955359#msg3955359
Title: Re: How to resolve deprecated error?
Post by: La_Lafayette on December 06, 2018, 01:22:20 AM
// 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 is the function i have to add to suppress it right?
Title: Re: How to resolve deprecated error?
Post by: Aleksi "Lex" Kilpinen on December 06, 2018, 01:28:10 AM
That would be for php 7.2.0 specifically.

That's not really an ideal solution though, as it will only work on that specific version, and it will only stop SMF from logging the error. It won't do anything to stop your server still probably having thousands of those errors logged.

Something like E_DEPRECATED && (version_compare(phpversion(), '7.2') >= 0) would probably be better for the version comparison.

Officially, SMF 2.0 does not support 7.2
Title: Re: How to resolve deprecated error?
Post by: SpacePhoenix on December 06, 2018, 01:51:09 AM
Version 7.0 of PHO went EOL at the start of the week. Version 5.6 (the very last 5.x version) goes EOL at the end of this month. It might be worth the OP asking their host if they plan on migrating some or all of their servers over to a 7.x version of PHP and which one they intend to migrate to
Title: Re: How to resolve deprecated error?
Post by: Aleksi "Lex" Kilpinen on December 06, 2018, 01:54:26 AM
Quote from: SpacePhoenix on December 06, 2018, 01:51:09 AM
Version 7.0 of PHO went EOL at the start of the week. Version 5.6 (the very last 5.x version) goes EOL at the end of this month. It might be worth the OP asking their host if they plan on migrating some or all of their servers over to a 7.x version of PHP and which one they intend to migrate to
Unless I am greatly mistaken, the error is _because_ the server has been migrated to 7.2. Not the other way around.
Title: Re: How to resolve deprecated error?
Post by: SpacePhoenix on December 06, 2018, 03:11:13 AM
Quote from: Aleksi "Lex" Kilpinen on December 06, 2018, 01:54:26 AM
Quote from: SpacePhoenix on December 06, 2018, 01:51:09 AM
Version 7.0 of PHO went EOL at the start of the week. Version 5.6 (the very last 5.x version) goes EOL at the end of this month. It might be worth the OP asking their host if they plan on migrating some or all of their servers over to a 7.x version of PHP and which one they intend to migrate to
Unless I am greatly mistaken, the error is _because_ the server has been migrated to 7.2. Not the other way around.

It's possible that the OPs host might have some servers that won't be migrated to 7.2 (or at least have other PHP versions available), only the OPs host would know what the plans are for PHP version migration
Title: Re: How to resolve deprecated error?
Post by: Aleksi "Lex" Kilpinen on December 06, 2018, 03:29:58 AM
That is true, and on any better host also likely.
Title: Re: How to resolve deprecated error?
Post by: a10 on December 06, 2018, 06:19:21 AM
7.1 works perfect for 2.0.15

Any host worthy of ones money offers some php version choice.
Title: Re: How to resolve deprecated error?
Post by: SpacePhoenix on December 06, 2018, 02:34:26 PM
Back when 4 went EOL did every host migrate all their servers over to 5 very shortly afterwards?
Title: Re: How to resolve deprecated error?
Post by: Arantor on December 06, 2018, 02:52:23 PM
No, it took YEARS. There's plenty of hosting still on 5.3.