Buy Now
Sign in

create_function deprecated - Php 7.2 Joomla 3.9 CCv5

saol89 , November 16 2018
saol89
Can you help me?
I have last versione of CCv5 on Joomla 3.9 with php 7.2 (i can't update to CCv6 now)

​PHP Deprecated: Function create_function() is deprecated in administrator/components/com_chronoconnectivity5/chronoconnectivity/helpers/lister.php on line 218 ​
​​
​PHP Deprecated: Function create_function() is deprecated in /libraries/cegcore/helpers/html.php on line 59
the line of error is this:
 $data_columns[$field]['function'] = create_function('$cell, $row', $functions[$k]);
healyhatman
https://stackoverflow.com/questions/48161526/php-7-2-function-create-function-is-deprecated
Just change the code, not sure when v5 will be updated
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

DON'T COPY+PASTE FROM THE FORUMS! It adds hidden code-breaking format characters!
saol89
can you help me convert this?
 $data_columns[$field]['function'] = create_function('$cell, $row', $functions[$k]);
saol89
Thank
saol89
instead, in the file
 /libraries/cegcore/helpers/html.php on line 59
the error is on the row "return...."
 public static function styles($styles = array()){​
​ if(is_string($styles)){​
​ return $styles;​
​ }​
​(-->ERROR HERE) return implode('; ', array_map(create_function('$k,$v', 'return $k.":".$v;'), array_keys($styles), array_values($styles)));​
​ }
GreyHead
Hi saol89.
The simplest fix is to set Site Error Reporting to System Default or to None which will prevent PHP Notices and Warnings from showing.
The other one is to replace the code as follows:
For the CC Notice try replacing :
create_function('$cell, $row', $functions[$k])
with​
​ function($cell, $row) {return $functions[$k]}
NB I don't see the CC Error so can't check that this is correct!
For the CF notice in line 59 replace
create_function('$k,$v', 'return $k.":".$v;')
with
function($k, $v) {return $k.":".$v;}
Bob
NB You may need to retype these as copying code from the forum can include unwanted invisible characters!!!​
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
saol89
Thank you Bob!