Error after upgrading to php 7.3: "Deprecated: Function create_function() "

Started by verticality, April 24, 2020, 03:21:02 PM

Previous topic - Next topic

verticality

Hello coders!
After upgrading my version of php from 7.1 to 7.3 my forum started to display this lines of code at the header of the forum, destroying all the design.
¿Does someone can give me a hand to find how to fix it?

Deprecated: Function create_function() is deprecated in /home/mochila/public_html/forum/Sources/Subs.php on line 1088

Deprecated: Function create_function() is deprecated in /home/mochila/public_html/forum/Sources/Subs.php on line 1130

Deprecated: Function create_function() is deprecated in /home/mochila/public_html/forum/Sources/Subs.php on line 1179

Deprecated: Function create_function() is deprecated in /home/mochila/public_html/forum/Sources/Subs.php on line 1195

Deprecated: Function create_function() is deprecated in /home/mochila/public_html/forum/Sources/Subs.php on line 1214

Deprecated: Function create_function() is deprecated in /home/mochila/public_html/forum/Sources/Subs.php on line 1225

Deprecated: Function create_function() is deprecated in /home/mochila/public_html/forum/Sources/Subs.php on line 1299

Deprecated: Function create_function() is deprecated in /home/mochila/public_html/forum/Sources/Subs.php on line 1310

Deprecated: Function create_function() is deprecated in /home/mochila/public_html/forum/Sources/Subs.php on line 1386

Deprecated: Function create_function() is deprecated in /home/mochila/public_html/forum/Sources/Subs.php on line 1485

Deprecated: Function create_function() is deprecated in /home/mochila/public_html/forum/Sources/Subs.php on line 1510

Deprecated: Function create_function() is deprecated in /home/mochila/public_html/forum/Sources/Subs.php on line 1547

Deprecated: Function create_function() is deprecated in /home/mochila/public_html/forum/Sources/Subs.php on line 1578

Deprecated: Function create_function() is deprecated in /home/mochila/public_html/forum/Sources/Subs.php on line 1589


I tried to return to php 7.1 but the problems is still there.

vbgamer45

What version of SMF are you on? Those errors should be suppressed if you are on latest SMF 2.0.x
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

Sir Osis of Liver

<sigh>  Officially, 2.0.17 supports php 7.2/7.3, but it contains deprecated code and will log a lot of errors.  There's a mod that fixes 7.2, haven't tried it, don't know if it works for 7.3 -

https://web-develop.ca/index.php?action=downloads;area=stable_smf_modifications;file=48
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Chen Zhen


My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Sir Osis of Liver

Thanks, Chen.  If I ever get around to updating my prod forums (still running 2.0.15 in php 7.1) I'll give it a try.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

Oh god we're not still arguing over the definition of 'supports', are we?

For the record, I agree with the team that 'supports' is fine here since the errors are warnings that 'you're using a thing that will go away in the future'. If your definition of 'supports' was as narrow as it is here, you should never have upgraded to SMF 1.1 or used PHP 5 ever since there are suppressions of errors of a similar vein for PHP 5 strict standards that couldn't be changed without breaking PHP 4 support which was necessary for a very long time.

Also, when this is removed in PHP 8, it becomes a pretty short replacement function that just works. It's only now while it's noisy that it's a problem.

verticality

Hi guys.
Still my problem hasn't been solved.
I'm running SMF 2.0.17  with PHP 7.1


I can't understand the origin of the problem in order to fix it.




vbgamer45

We can do a workaround and hide the errors if you wish by changing the error reporting setting i believe in index.php might be one other file though as well.
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

SpacePhoenix

If you've got xdebug installed, the "scream flag" might be turned on which causes the error suppression operator (the @ operator), to be ignored.

The "scream extension" can also have the same affect

Sir Osis of Liver

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

shawnb61

2.0.17 suppresses the errors.  Thru php 7.3, they should not even be logged.  There is something going on in some of these environments where the error suppression is - well, suppressed...

I think SpacePhoenix is on to something...
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Sir Osis of Liver

This is the downside of using deprecated code in a current release.  Some hosts are up to php 7.4, with no option to downgrade.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

verticality

I can change to whatever version of PHP I'd like, including 7.4.
But changing the version doesn't fix the error.

Feels like the last upgrade mess someting permanently.

Chen Zhen


My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

verticality

After trying everything mentioned above I solved the problem.

I used the fix mentioned above but it has errors and couldn't be implemented.

So what I did was to reinstall the forum following this guide
https://wiki.simplemachines.org/smf/How_to_upload_a_fresh_set_of_files

Then, and only then I could apply the fix properly.
Note: before the fix the problem persisted.

After that I reinstalled the mods and themes. Now everything runs smooth.

Thanks for the help guys!
I hope this experience can help someone else.

Chen Zhen

The utility performs many edits to SMF source files mostly concerning BBCode.
If you previously manually edited the particular code it looks for or if an outdated mod edited the particular code it looks for, it will show parsing errors.
Most up do date mods will use hooks to add things such as BBCode so it should rarely be an issue.

I'm glad you were able to figure it out and that your forum is now working without logging PHP deprecated errors.


My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Advertisement: