News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Help please! Call to undefined function create_function()

Started by Uhura!, March 26, 2024, 03:55:16 PM

Previous topic - Next topic

Uhura!

I get this error when attempting to access Admin on my site: Call to undefined function create_function()

Any advice?

:) Our Parenting Spot is an online parenting community for fathers, mothers, grandparents, teachers, and family service professionals. 8) We also provide low cost advertising options for authors, family service providers, and businesses with family friendly products and services. ;D Visit us @ www.OurParentingSpot.net!

Aleksi "Lex" Kilpinen

Your host has updated PHP, and you are not fully compatible with it. If that's the only issue that came up, this might help https://custom.simplemachines.org/index.php?mod=4300

Since you can't get to admin, this might take some maneuvering though.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Uhura!

Hello & thank you, Lex! are you willing to do a quick zoom and screen share with me to show me how to do this?

Is anyone available? I do not want to mess this up. Just 10 mins of your time.
:) Our Parenting Spot is an online parenting community for fathers, mothers, grandparents, teachers, and family service professionals. 8) We also provide low cost advertising options for authors, family service providers, and businesses with family friendly products and services. ;D Visit us @ www.OurParentingSpot.net!

vbgamer45

If not just attach your sources/subs.php
And just need to add it to end of file
before ?>

if (!function_exists('create_function'))
{
function create_function($args, $code)
{
return eval(sprintf('return function(%s) {%s};', $args, $code));
}
}
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

Uhura!

I could really use a quick lesson on this via zoom & screen share on my end.
:) Our Parenting Spot is an online parenting community for fathers, mothers, grandparents, teachers, and family service professionals. 8) We also provide low cost advertising options for authors, family service providers, and businesses with family friendly products and services. ;D Visit us @ www.OurParentingSpot.net!

Aleksi "Lex" Kilpinen

We generally don't do 1 on 1 like that, someone might but most of the team likely will not.
What vbgamer45 suggested, should be fairly easy though - Even easier if you just take a copy of the file from your server, and attach it to your next post so someone else here can do the edits for you.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Uhura!

I am following the directions but I cannot find the board directory. Any advice?
:) Our Parenting Spot is an online parenting community for fathers, mothers, grandparents, teachers, and family service professionals. 8) We also provide low cost advertising options for authors, family service providers, and businesses with family friendly products and services. ;D Visit us @ www.OurParentingSpot.net!

Kindred

What board directory?

Go to the location of your forum.
Go into the Sources directory
Find the file named  Subs.php
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Uhura!

This one (from the directions)

Manual Installation
This is for if you lose access to the package manager due to an error from a missing create_function():

Copy Subs-CreateFunction.php into your sources directory
Copy install.php to the board directory and execute it (remember to delete it afterwards!)
Equivalent to running the following PHP code
add_integration_function(
    'integrate_pre_include',
    '$sourcedir/Subs-CreateFunction.php
');
:) Our Parenting Spot is an online parenting community for fathers, mothers, grandparents, teachers, and family service professionals. 8) We also provide low cost advertising options for authors, family service providers, and businesses with family friendly products and services. ;D Visit us @ www.OurParentingSpot.net!

Uhura!

Quote from: Aleksi "Lex" Kilpinen on March 27, 2024, 03:59:27 AMWe generally don't do 1 on 1 like that, someone might but most of the team likely will not.
What vbgamer45 suggested, should be fairly easy though - Even easier if you just take a copy of the file from your server, and attach it to your next post so someone else here can do the edits for you.

I cannot locate the Board directory referenced at the link. Any advice?
:) Our Parenting Spot is an online parenting community for fathers, mothers, grandparents, teachers, and family service professionals. 8) We also provide low cost advertising options for authors, family service providers, and businesses with family friendly products and services. ;D Visit us @ www.OurParentingSpot.net!

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Sir Osis of Liver

You don't have to mess with code, just downgrade php version to 8.0 in your host control panel.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Diego Andrés

create_function was removed in 8.0, so would still have issues.
It would be easier and faster if he just installs the MOD using the Package Manager

SMF Tricks - Free & Premium Responsive Themes for SMF.

Sir Osis of Liver

Hmm, OP has links to two sites in sig, one doesn't load, other is 2.0.19 install.  Shouldn't be having create_function errors in latter, unless from mod.  2.0.19 action=admin loads normally in php 8.0, 8.1, 8.2, 8.3.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Uhura!

Quote from: Sir Osis of Liver on March 27, 2024, 09:53:33 PMYou don't have to mess with code, just downgrade php version to 8.0 in your host control panel.


This may be helpful. I will give it a try
:) Our Parenting Spot is an online parenting community for fathers, mothers, grandparents, teachers, and family service professionals. 8) We also provide low cost advertising options for authors, family service providers, and businesses with family friendly products and services. ;D Visit us @ www.OurParentingSpot.net!

Uhura!

:) Our Parenting Spot is an online parenting community for fathers, mothers, grandparents, teachers, and family service professionals. 8) We also provide low cost advertising options for authors, family service providers, and businesses with family friendly products and services. ;D Visit us @ www.OurParentingSpot.net!

Uhura!

Quote from: Sir Osis of Liver on March 27, 2024, 10:44:30 PMHmm, OP has links to two sites in sig, one doesn't load, other is 2.0.19 install.  Shouldn't be having create_function errors in latter, unless from mod.  2.0.19 action=admin loads normally in php 8.0, 8.1, 8.2, 8.3.


Untrue & unhelpful
:) Our Parenting Spot is an online parenting community for fathers, mothers, grandparents, teachers, and family service professionals. 8) We also provide low cost advertising options for authors, family service providers, and businesses with family friendly products and services. ;D Visit us @ www.OurParentingSpot.net!

Uhura!

Quote from: Sir Osis of Liver on March 27, 2024, 09:53:33 PMYou don't have to mess with code, just downgrade php version to 8.0 in your host control panel.


Darn it!

Lowest avl is 8.1
:) Our Parenting Spot is an online parenting community for fathers, mothers, grandparents, teachers, and family service professionals. 8) We also provide low cost advertising options for authors, family service providers, and businesses with family friendly products and services. ;D Visit us @ www.OurParentingSpot.net!

Aleksi "Lex" Kilpinen

#18
Downgrading to 8.0 will not fix this.

If you can go to your hosting control panel and download a copy of your Sources/Subs.php from the forum files to attach to your next post here, I'm sure someone can edit it for you like vbgamer45 suggested.

Quote from: vbgamer45 on March 26, 2024, 04:19:22 PMIf not just attach your sources/subs.php
And just need to add it to end of file
before ?>

if (!function_exists('create_function'))
{
function create_function($args, $code)
{
return eval(sprintf('return function(%s) {%s};', $args, $code));
}
}

Do note though, that 2.0 is officially only supporting PHP versions up to 8.0 - So you should really consider upgrading SMF.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Sir Osis of Liver

Quote from: Uhura! on March 28, 2024, 03:23:22 PM
Quote from: Sir Osis of Liver on March 27, 2024, 10:44:30 PMHmm, OP has links to two sites in sig, one doesn't load, other is 2.0.19 install.  Shouldn't be having create_function errors in latter, unless from mod.  2.0.19 action=admin loads normally in php 8.0, 8.1, 8.2, 8.3.


Untrue & unhelpful

Not sure what you're objecting to.  https://ourmomspot.net/community/ loads a 2.0.19 forum.  https://www.ourparentingspot.net/ fails to load.

Just to clarify, there's only one call to create_function in 2.0.19 core, it's an error handler in Errors.php.  The error you're getting when accessing Admin is not being caused by core code, so it must be from a mod or manual edit.

But do what Lex and vbgamer suggested, attach the file and someone will fix it.

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

                                     - R. Waters

Advertisement: