Jump to content

Impossible d'aller sur la page d'admin


Recommended Posts

Bonjour,

 

Une fois que je saisis mon login/mot de passe pour accéder a l'admin je suis redirigé sur la dashboard et là page blanche depuis ce matin (aucune mise à jour faite). En regardant les logs j'ai ceci:

Quote

PHP Fatal error:  Call to a member function assign() on null in .../classes/controller/AdminController.php on line 2330

Le code concerné (il s'agit du dernier assign):
 

        $this->context->smarty->assign(array(
            'table' => $this->table,
            'current' => self::$currentIndex,
            'token' => $this->token,
            'host_mode' => defined('_PS_HOST_MODE_') ? 1 : 0,
            'stock_management' => (int)Configuration::get('PS_STOCK_MANAGEMENT')
        ));

        if ($this->display_header)
            $this->context->smarty->assign('displayBackOfficeHeader', Hook::exec('displayBackOfficeHeader', array()));
        
        $this->context->smarty->assign(array(
            'displayBackOfficeTop' => Hook::exec('displayBackOfficeTop', array()),
            'submit_form_ajax' => (int)Tools::getValue('submitFormAjax')
        ));

On a la version 1.6 de PS. Une idée?

Edited by Spir (see edit history)
Link to comment
Share on other sites

4 hours ago, doekia said:

c'est donc le smarty qui est null.

Version exacte?

Je soupçonne que ton hébergeur t'a changé ta version de PHP. Max PHP 5.6. A moins que tu n'ai fais des changements récent (mise à jour module)

Je crois que c'est ca! J'ai effectivement une vieille version de PHP (PHP 5.6.33). Avec PS 1.6.0.8. Faudrait que je met à jour mais je ne suis pas sûr que tout fonctionne correctement sur du PHP 7.2!

Finalement j'ai pu corriger le problème en regardant la ligne d'erreur juste avant:

Quote

 PHP Notice:  Constant _PS_OS_PAYPAL_ already defined in .../config/config.inc.php on line 230

Effectivement on trouve ca dans le fichier config.inc.php:
 

define('_PS_OS_CHEQUE_',      Configuration::get('PS_OS_CHEQUE'));

...

/* Get smarty */
require_once(dirname(__FILE__).'/smarty.config.inc.php');
$context->smarty = $smarty;

J'ai donc rajouté un check des definitions des constantes:

/**
 * @deprecated : these defines are going to be deleted on 1.6 version of Prestashop
 * USE : Configuration::get() method in order to getting the id of order status
 */
if (!defined('_PS_OS_CHEQUE_')) 	define('_PS_OS_CHEQUE_',      Configuration::get('PS_OS_CHEQUE'));
if (!defined('_PS_OS_PAYMENT_')) 	define('_PS_OS_PAYMENT_',     Configuration::get('PS_OS_PAYMENT'));
if (!defined('_PS_OS_PREPARATION_')) 	define('_PS_OS_PREPARATION_', Configuration::get('PS_OS_PREPARATION'));
if (!defined('_PS_OS_SHIPPING_')) 	define('_PS_OS_SHIPPING_',    Configuration::get('PS_OS_SHIPPING'));
if (!defined('_PS_OS_DELIVERED_')) 	define('_PS_OS_DELIVERED_',   Configuration::get('PS_OS_DELIVERED'));
if (!defined('_PS_OS_CANCELED_')) 	define('_PS_OS_CANCELED_',    Configuration::get('PS_OS_CANCELED'));
if (!defined('_PS_OS_REFUND_')) 	define('_PS_OS_REFUND_',      Configuration::get('PS_OS_REFUND'));
if (!defined('_PS_OS_ERROR_'))		define('_PS_OS_ERROR_',       Configuration::get('PS_OS_ERROR'));
if (!defined('_PS_OS_OUTOFSTOCK_')) 	define('_PS_OS_OUTOFSTOCK_',  Configuration::get('PS_OS_OUTOFSTOCK'));
if (!defined('_PS_OS_BANKWIRE_')) 	define('_PS_OS_BANKWIRE_',    Configuration::get('PS_OS_BANKWIRE'));
if (!defined('_PS_OS_PAYPAL_')) 	define('_PS_OS_PAYPAL_',      Configuration::get('PS_OS_PAYPAL'));
if (!defined('_PS_OS_WS_PAYMENT_')) 	define('_PS_OS_WS_PAYMENT_', Configuration::get('PS_OS_WS_PAYMENT'));

Ca résoud le problème. 🤦‍♂️

Edited by Spir (see edit history)
Link to comment
Share on other sites

  • 7 months later...

J'ai encore eu une erreur similaire aujourd'hui:

Quote

PHP Notice:  Constant _PS_SSL_PORT_ already defined in config/config.inc.php on line 31
PHP Notice:  Constant _THEME_NAME_ already defined in config/config.inc.php on line 106
PHP Notice:  Constant __PS_BASE_URI__ already defined in config/config.inc.php on line 107
PHP Notice:  Undefined variable: smarty in config/config.inc.php on line 235
PHP Fatal error:  Call to a member function assign() on null in classes/controller/AdminController.php on line 2330

J'ai donc rajouter ca pour corriger le problème:

if (!defined('_PS_SSL_PORT_'))         define('_PS_SSL_PORT_',      Configuration::get('PS_SSL_PORT_'));
if (!defined('_THEME_NAME_'))         define('_THEME_NAME_',       Configuration::get('THEME_NAME_'));
if (!defined('__PS_BASE_URI__'))     define('__PS_BASE_URI__',    Configuration::get('PS_BASE_URI__'));

 

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...