Got a fatal error with qtranslate-xp

964 views Asked by At

I reinstalled a website after upgrading to wordpress 4.8.1 and I have a fatal error when I activate the qtranslate-xp plugin:

Cannot redeclare qs_base64_serialize() (previously declared in /home/xxx/www/xxx/wp-content/plugins/qtranslate/qtranslate_services.php:80) in /home/xxx/www/xxx/wp-content/plugins/qtranslate-xp/ppqtranslate_services.php on line 91

Here are the lines:

// serializing/deserializing functions
function qs_base64_serialize($var) {
    if(is_array($var)) {
        foreach($var as $key => $value) {
            $var[$key] = qs_base64_serialize($value);
        }
    }
    $var = serialize($var);
    $var = strtr(base64_encode($var), '-_,', '+/=');
    return $var;
}

I tried to comment these lines but I got an other fatal error later on.

It seems that qtranslate main plugin (Version 2.5.39 | By Qian Qin) is correctly activated but doesn't work. Qtranslate Plus: Version 2.7.2 | By Papa Salvatore Mirko (Originally created by Qian Qin).

Actually, these 2 plugin pages are not accessible anymore and I couldn't find any solutions.

2

There are 2 answers

1
user8230352 On BEST ANSWER

According to qtranslate-xp GitHub page:

IMPORTANT: This is not an Extension of the official qTranslate.

qTranslate Plus is an unOfficial modified version of qTranslate.

Since the qTranslate-xp is a whole plugin and not an add-on to qTranslate, you should remove or at least deactivate the original qTranslate plugin.

As it is now, you have both original and forked version of the plugin activated on your website, so this might be the cause of your problem.

3
Akshay Shah On

Try below code

if (!function_exists('qs_base64_serialize')) {
function qs_base64_serialize(){
 if(is_array($var)) {
    foreach($var as $key => $value) {
        $var[$key] = qs_base64_serialize($value);
    }
 }
 $var = serialize($var);
 $var = strtr(base64_encode($var), '-_,', '+/=');
 return $var;
 }
}