Buy Now
Sign in

FAQ search

Issues with new PHP and Joomla versions

Details
Published: Monday, 18 October 2021 15:20

As you may know, Max - the owner and developer here - has been absent for several months dealing with some issues that are not related to the Chrono Products. Meanwhile there have been upgrades to PHP and a new version of Joomla. These upgrades have inevitably caused some problems with the current versions of the Chrono Products.

User Elitakey has found and published fixes that resolve some of the error messages we are seeing. In this FAQ I plan to record these and other solutions as they come to light.

PHP8 errors with CFv6 and CCv6 

Errors with backup download

preg_replace() now expects at least three arguments, but only two are given in the current code. The arguments should be -
preg_replace($patterns, $replacements, $string)
 
Here is the current code at line 371 of administrator/components/com_chronoforms6/chronoforms/controllers/connections.php 
and line 188 of administrator/components/com_chronoconnectivity6/chronoconnectivity/controllers/connections.php
 
if(preg_replace('Opera(/| )([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT'])){
   $UserBrowser = 'Opera';
}elseif(preg_replace('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT'])){
   $UserBrowser = 'IE';
}else{
   $UserBrowser = '';
}
 
Adding an empty string ' ' as the extra argument seems to solve the error 
 
if(preg_replace('Opera(/| )([0-9].[0-9]{1,2})', ' ', $_SERVER['HTTP_USER_AGENT'])){
   $UserBrowser = 'Opera';
} elseif(preg_replace('MSIE ([0-9].[0-9]{1,2})', ' ', $_SERVER['HTTP_USER_AGENT'])){
   $UserBrowser = 'IE';
} else {
   $UserBrowser = '';
}

Call to undefined function get_magic_quotes_gpc() 

Locate the folder /libraries/cegcore2, open gcloader.php and comment out this block (lines 63-71):
 
/*
if(get_magic_quotes_gpc()){
 function stripslashes_gpc(&$value){
 $value = stripslashes($value);
 }
 array_walk_recursive($_GET, 'stripslashes_gpc');
 array_walk_recursive($_POST, 'stripslashes_gpc');
 array_walk_recursive($_COOKIE, 'stripslashes_gpc');
 array_walk_recursive($_REQUEST, 'stripslashes_gpc');
 }
*/
 
Then open /libraries/cegcore2/libs/helper.php and 
find and comment out these two lines:
 
/*
$this->_vars = &$view->_vars; 
$this->data = &$view->data;
*/
 
and insert this code after them:
 
$this->_vars = "";
if (isset($view->_vars ) && $view->_vars != "") {
    $this->_vars = &$view->_vars;
}
$this->data = "";
if (isset($view->data ) && $view->data != "") {
    $this->data = &$view->data;
}
 
NB If you later install ChronoConnectivity then these changes may need to be made again.
 

Error on view form "Attempt to modify property "_vars" on null"

Open /libraries/cegcore2/libs/composer.php and comment out this line
 
​/*
$this->_vars = &$app->_vars;
*/
 
and insert this code after it:
 
$this->_vars = "";
if (isset($app->_vars ) && $app->_vars != "") {
  $this->_vars = &$app->_vars;
}
  
NB Elitakey says: "this is for CF6 and CCv6 only; however I do believe this will work for CF7 too. The only difference is that cegcore2 there is called chronog3 and is located in the folder /plugins/system/chronog3_plg/chronog3/libs "
 

There is no "NOT IN" array condition in a Read Database Element, Where Conditions...

It's necessary to replace 'NOT' => 'NOT' by 'NOT IN' => 'NOT IN' in these files:
 
 \administrator\components\com_chronoforms7\behaviors\functions\data_conditions\data_conditions_config.php (line 29 and line 125)
 
\administrator\components\com_chronoforms7\shared\models\data_conditions\conditions.php (line 44)
 
\administrator\components\com_chronoforms7\behaviors\functions\data_relations\rconditions.php (line 47)
 
Thanks to user Colnem
 

Call to undefined method Joomla\CMS\Application\AdministratorApplication::isAdmin()

The calling code needs to be changed to Joomla\CMS\Application\AdministratorApplication::isClient('administrator')
 

syntax error, unexpected 'Fn' (T_FN)

Thanks to user lukaluka:
 
Some features have been added and deprecated in php 7.4, read here
 
At the line 31 of PHP 7.4 UPGRADE NOTES report this: "fn" is now a reserved keyword. In particular, it can no longer be used as a function or class name. It can still be used as a method or class constant name.
So I made the following changes:
 
go to folder <site root>\administrator\components\com_chronoforms5\chronoforms\events\fn
 
open the fn.php file and on line 9 edit like this ->
namespace GCore\Admin\Extensions\Chronoforms\Events\Fn1;
 
at the line 12 edit like this ->
class Fn1 extends \GCore\Admin\Extensions\Chronoforms\Events\Event
 
save and close the file fn.php
rename the file fn.php as fn1.php
 
rename the directory administrator\components\com_chronoforms5\chronoforms\events\fn as administrator\components\com_chronoforms5\chronoforms\events\fn1
 

CFv7 with Joomla 4

When I hit "Editor", the Text Area disappears...

With a new install of J4, TinyMCE 5, the 'modern' theme doesn't exist.
Solution: in the file /plugins/system/chrono3_plg/chrono3/assets/js/g3.tinymce.js, line 24, replace 'modern' by 'silver'
 
Thanls to user colnem.