Advertisement:

Author Topic: PHP 7.2, create_function() and old mods code  (Read 909 times)

Offline Arris

  • Semi-Newbie
  • *
  • Posts: 13
PHP 7.2, create_function() and old mods code
« on: October 06, 2018, 11:48:37 AM »
http://php.net/manual/en/function.create-function.php [nofollow]

create_function — Create an anonymous (lambda-style) function

Warning
This function has been DEPRECATED as of PHP 7.2.0. Relying on this function is highly discouraged.

So, some mods uses create_function() in their install.xml or source code.

Is there any recommendations for migration to valid code?

Online d3vcho();

  • Sempiterno
  • Lead Localizer
  • SMF Hero
  • *
  • Posts: 3,323
  • Gender: Male
    • frandominguez03 on GitHub
Re: PHP 7.2, create_function() and old mods code
« Reply #1 on: October 06, 2018, 12:00:10 PM »
PHP 7.2.x is not supported by SMF 2.0.x at this time.
"These good ideas will tear your brains apart"

d3vcho(void)

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 70,934
    • StoryBB/StoryBB on GitHub
Re: PHP 7.2, create_function() and old mods code
« Reply #2 on: October 06, 2018, 12:29:13 PM »
The only migration is to sit and rewrite every single bbcode mod (plus any others that used it).

All of the base ones in 2.1 are done but migrating this for 2.0 is borderline impossible to get right in a fixes-everything way.
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 Arris

  • Semi-Newbie
  • *
  • Posts: 13
Re: PHP 7.2, create_function() and old mods code
« Reply #3 on: October 06, 2018, 01:24:15 PM »
Can I migrate from 2.0.15 to 2.1+ without problems?

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 70,934
    • StoryBB/StoryBB on GitHub
Re: PHP 7.2, create_function() and old mods code
« Reply #4 on: October 06, 2018, 01:27:34 PM »
Well, 2.1 isn't ready yet. When it is, you will still need to get your theme updated (since 2.0 themes aren't compatible with 2.1), bbcode mods will definitely need updating, other mods may need updates too.

The fewer mods and changes you have, the better the upgrade possibility.
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 Ali_

  • Semi-Newbie
  • *
  • Posts: 62
Re: PHP 7.2, create_function() and old mods code
« Reply #5 on: April 14, 2019, 01:46:38 PM »
This causes my smf_log_errors table to grow incredibly fast.  It was bigger than the actual forum board/topics and now I have to create a stored proceedure and an event to truncate that table once every day.  Otherwise, mysql ends up filling memory with this nonsense.  I am worried about the hit it takes on IO.   The error log grew to 1GB in a couple of days.

Can I re-write the Subs.php file where the error seems to orgininate so that it doesn't use create_function(), but rather an anonymous function?  Has anyone done this?

Offline vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 21,174
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: PHP 7.2, create_function() and old mods code
« Reply #6 on: April 14, 2019, 01:48:39 PM »
Yes you can for default SMF mod at https://www.smfhacks.com/index.php?action=downloads;sa=view;id=215 that does most of it.
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 Kiriakos GR

  • Jr. Member
  • **
  • Posts: 181
  • Gender: Male
    • @ITTSB_EU on Twitter
Re: PHP 7.2, create_function() and old mods code
« Reply #7 on: April 15, 2019, 08:16:39 AM »
Any one using cPanel for web site management,  he may use MultiPHP manager module and select PHP 5.6  as default PHP engine.

By using SMF2.0.X-enablePHP7.2Compat_v1.3,  this masked the problem but when tried to uninstall old mod which was still delivering errors,  my forum crashed ( white index ). 

I was had to restore files backup and database backup, then switched to PHP 5.6, and now I am back in the world of livings.
Old backup this deactivated SMF2.0.X-enablePHP7.2Compat_v1.3 and forum functionality this is now restored.

Error log clear, no issues at all.     

Offline GigaWatt

  • The Smiley Guy
  • Support Specialist
  • SMF Hero
  • *
  • Posts: 1,946
  • Gender: Male
    • Macedonian electronics forum
Re: PHP 7.2, create_function() and old mods code
« Reply #8 on: April 15, 2019, 10:08:19 PM »
You can always choose PHP 7.1, it's still supported (till the end of this year, I think ???).
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Offline Ali_

  • Semi-Newbie
  • *
  • Posts: 62
Re: PHP 7.2, create_function() and old mods code
« Reply #9 on: April 19, 2019, 11:26:43 AM »
@vbgamer45. Thank you, it worked like a charm.