Forums

PHP 7.2 Error

jwill 10 Oct, 2019
I have several long complex forms on a site that almost never has changes. Because the forms work, I have never wanted to spend the time to rebuild all of the forms. After updating to PHP 7.2, I am receiving the following warning:

"Deprecated: Function create_function() is deprecated in /home/metro103/public_html/components/com_chronoforms/libraries/chronoform.php on line 410"

Is there an easy fix for this that will keep me from having to rebuild all of the forms?

Jim
jwill 10 Oct, 2019
Answer
So would the bold part of this line

function _camilize($class = ''){
return preg_replace_callback('/(?:^|_)(.?)/i',create_function('$matches', 'return strtoupper($matches[1]);'), $class);
}
Be changed to this
function('$matches'){return strtoupper ($matches[1];},
Jim
healyhatman 11 Oct, 2019
function('$matches'){return strtoupper ($matches[1]);},

but yes, something like that.
jwill 12 Oct, 2019
Thanks,

Jim
dtsilog 04 Aug, 2020
1 Likes
Thank you Bob and all, i had the same error in my Joomla site:

"Deprecated: Function create_function() is deprecated in *****/components/com_chronoforms/libraries/chronoform.php on line 410".

In chronoform.php file and line 410 i replaced ONLY below code:
create_function('$matches', 'return strtoupper($matches[1]);')
with this:
function($matches){return strtoupper($matches[1]);}
and it worked, error message dissapeard!! The only difference is that function('$matches') needs to be function($matches) - without ' '.

Tested on PHP 7.2 and 7.3, i still use Chronoforms 4.0.8 and latest joomla 3.9.20.

Thank you again!
This topic is locked and no more replies can be posted.