Skip to main content Help Control Panel

YACS CMS : Open source !

Community «   Le forum «   Besoin d'aide «   Problème migration 7.4 vers 7.6 chez 1and1 «  

Comment: Problème migration 7.4 vers 7.6 chez 1and1

<< Previous Next >>
Le problème de mise en oeuvre de la version 7.6 provient d'un bug d'implémentation PHP chez 1and1, qui fait que la variable PHP_INFO, fournie par le serveur, contient le nom du script appelé dans certains cas et pas dans d'autres. Le résultat, c'est que YACS est complètement perdu dans la pagination dynamique, et génère des requêtes stupides vers la base de données.

Le correctif est de patcher le fichier shared/global.php en remplacant les lignes 269 et suivantes :

// analyze script args (e.g. 'articles/view.php/123/3', where '123' is the
    
article id, and '3' is the page number)
if(isset(
$_SERVER['PATH_INFO']) && strlen($_SERVER['PATH_INFO'])) {

    
// split all args, if any, and decode each of them
    
$context['arguments'] = array();
    
$arguments explode('/'substr($_SERVER['PATH_INFO'], 1));
    if(
is_array($arguments)) {
        foreach(
$arguments as $argument)
            
$context['arguments'][] = rawurldecode($argument);
    }
}



par

// we cannot rewrite $_SERVER
$path_info '';
if(isset(
$_SERVER['PATH_INFO']) && strlen($_SERVER['PATH_INFO']))
    
$path_info $_SERVER['PATH_INFO'];

// a tricky way to set path info correctly at some sites
elseif(isset($HTTP_SERVER_VARS['ORIG_PATH_INFO']) &&
    
$HTTP_SERVER_VARS['ORIG_PATH_INFO'])
    
$path_info $HTTP_SERVER_VARS['ORIG_PATH_INFO'];

// sometimes this also contains the script name, which is a PHP bug
if(preg_match('/^.+?.php/'$path_info$matches))
    
$path_info str_replace($matches[0], ''$path_info);

// analyze script args (e.g. 'articles/view.php/123/3', where '123' is the
    
article id, and '3' is the page number)
if(
strlen($path_info)) {

    
// split all args, if any, and decode each of them
    
$context['arguments'] = array();
    
$arguments explode('/'substr($path_info1));
    if(
is_array($arguments)) {
        foreach(
$arguments as $argument)
            
$context['arguments'][] = rawurldecode($argument);
    }
}



Pour les pressés, utiliser le fichier ci-dessous.

20070711-patch-7-6-shared.zip

This comment has inspired:

by Bernard on Jul. 11 2007