Jump to content

PHP Fatal error: Uncaught Error: Call to a member function getModuleLink()


Recommended Posts

Bonjour à tous,

En train de finaliser ma boutique, ayant retouché beaucoup de choses sur mon thème, je me suis rendu compte hier en regardant mon panier et en cliquant sur "Panier" puis "Commander" je tombe sur une page blanche, avec un chargement infini avec l'image dynamique de chargement au centre.

En regardant les logs d'erreur apache, j'ai trouvé ça : 

Quote

[Wed May 08 19:12:48.838515 2019] [:error] [pid 32035] [client 90.66.67.217:62577] PHP Fatal error:  Uncaught Error: Call to a member function getModuleLink() on string in /data/www/XXX/var/cache/prod/smarty/compile/46/d6/c9/46d6c9e1024c45f987a1fd78afcb374dc74be0bb_2.file.footerlink.tpl.php:26\nStack trace:\n#0 /data/www/XXX/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_5cd30d802df9b1_29034966(Object(Smarty_Internal_Template))\n#1 /data/www/XXX/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(Smarty_Internal_Template))\n#2 /data/www/XXX/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render(Object(Smarty_Internal_Template))\n#3 /data/www/XXX/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(232): Smarty_Internal_Template->render(false, 0)\n#4 /data/www/XXX/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(116): Smarty_Internal_TemplateBase in /data/www/XXX/var/cache/prod/smarty/compile/46/d6/c9/46d6c9e1024c45f987a1fd78afcb374dc74be0bb_2.file.footerlink.tpl.php on line 26, referer: https://domaine.com/fiche_produit.html

J'ai jeté un oeil sur le net qui parlait du module paypal que j'ai désactivé. Sans aucun changement.

Avez-vous une idée ?

Merci d'avance.

EDIT : Je suis en version 1.7.5.0 et en thème PRSD50 v1.0.2 modifié

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

Bonjour @Eolia merci pour ta réponse.

En terme de module, je n'ai que les suivants

image.thumb.png.e9fa874a0639ea185051e7460ce1ac2a.png

et

image.png.3d4fd7da4c7a02d917db0ae0cc111a41.png

Je ne trouve pas de footerlink.

Concernant la liste de liens (Link Widget), elle a été substitué par le thème installé par la suite.

Link to comment
Share on other sites

qui y a-t-il dans les premières lignes de ce fichier svp ? /cache/prod/smarty/compile/46/d6/c9/46d6c9e1024c45f987a1fd78afcb374dc74be0bb_2.file.footerlink.tpl.php

Il y aura le nom du controller ou du module

Link to comment
Share on other sites

Voici

<?php
/* Smarty version 3.1.33, created on 2019-05-08 20:04:39
  from '/data/www/XXX/modules/rvwishlistblock/views/templates/hook/footerlink.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '3.1.33',
  'unifunc' => 'content_5cd31a37d96470_07524781',
  'has_nocache_code' => false,
  'file_dependency' =>
  array (
    '46d6c9e1024c45f987a1fd78afcb374dc74be0bb' =>
    array (
      0 => '/data/www/XXX/modules/rvwishlistblock/views/templates/hook/footerlink.tpl',
      1 => 1549227013,
      2 => 'file',
    ),
  ),
  'includes' =>
  array (
  ),
),false)) {
function content_5cd31a37d96470_07524781 (Smarty_Internal_Template $_smarty_tpl) {
?>
<li>
    <a href="<?php echo htmlspecialchars(call_user_func_array($_smarty_tpl->registered_plugins[ 'modifier' ][ 'escape' ][ 0 ], array( $_smarty_tpl->tpl_vars['link']->value->getModuleLink('rvwishlistblock','mywishlist',array(),true),'html','UTF-8' )), ENT_QUOTES, 'UTF-8');?>
" title="<?php echo call_user_func_array( $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'My wishlists','mod'=>'rvwishlistblock'),$_smarty_tpl ) );?>
">
        <?php echo call_user_func_array( $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'My Wishlist','mod'=>'rvwishlistblock'),$_smarty_tpl ) );?>

    </a>
</li>
<?php }
}

rvwishlistblock ?

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

Merci pour ces réponses :)

J'ai désactivé le module en question pour test, et l'erreur est désormais passé sur 

Quote

Uncaught Error: Call to a member function getCMSLink() on string in /data/www/XXX/var/cache/prod/smarty/compile/c0/e5/12/c0e5128f00cd799bc0ba5e56134fe02699d7d68d_2.module.rvpaymentlogoviewstemplat.php

J'ai donc désactivé également le module rvpaiement après quoi mon problème a disparu du front.

Alors c'est bien joli mais la question va être : Pourquoi ces modules posent problèmes sachant que je ne les ai pas touché, à part la traduction 😕 

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

ces modules sont là depuis votre install 1.7 ou viennent-ils d'une ancienne version ?

Normalement getCMSLink est une propriété de l'objet $link qui doit être diponible en front, or on dirait que chez vous il n'est pas chargé ou mal, PHP le reconnait comme du texte (string) au lieu d'un objet...

Link to comment
Share on other sites

Ces modules ont été installé sur un PS vierge en 1.7.5.0.

Le .TPL est définit comme tel :

{if isset($cms_payment_logo) && $cms_payment_logo}
        <div id="payment_logo_block_left" class="payment_logo_block col-lg-4 col-md-12">
        <span>Payment</span>
                <a href="{$link->getCMSLink($cms_payment_logo)|escape:'html'}">
                        <img src="{$path}views/img/visa.png" alt="Visa" width="40" height="25" />
                        <img src="{$path}views/img/mastercard.png" alt="Mastercard" width="40" height="25" />
                        <img src="{$path}views/img/paypal.png" alt="Paypal" width="40" height="25" />
                        <img src="{$path}views/img/amex.png" alt="American Express" width="40" height="25" />
                        <img src="{$path}views/img/discover.png" alt="Discover" width="40" height="25" />
                        <img src="{$path}views/img/jcb.png" alt="JCB" width="40" height="25" />
                </a>
        </div>
{/if}

Où puis-je remonter pour voir comment est paramétré $link ?

Link to comment
Share on other sites

Effectivement c'est ce fichier.

Je n'y ai rien trouvé de particulier à part :

Quote

 $protocol_link = (Configuration::get('PS_SSL_ENABLED') || Tools::usingSecureMode()) ? 'https:'//' : 'http://';
        $useSSL = ((isset($this->ssl) && $this->ssl && Configuration::get('PS_SSL_ENABLED')) || Tools::usingSecureMode()) ? true : false;
        $protocol_content = ($useSSL) ? 'https://' : 'http://';
 

Que mon éditeur prend les // comme un commentaire.

Link to comment
Share on other sites

avec

{var_dump($link)}
{if isset($cms_payment_logo) && $cms_payment_logo}
        <div id="payment_logo_block_left" class="payment_logo_block col-lg-4 col-md-12">
        <span>Payment</span>
                <a href="{$link->getCMSLink($cms_payment_logo)|escape:'html'}">
                        <img src="{$path}views/img/visa.png" alt="Visa" width="40" height="25" />
                        <img src="{$path}views/img/mastercard.png" alt="Mastercard" width="40" height="25" />
                        <img src="{$path}views/img/paypal.png" alt="Paypal" width="40" height="25" />
                        <img src="{$path}views/img/amex.png" alt="American Express" width="40" height="25" />
                        <img src="{$path}views/img/discover.png" alt="Discover" width="40" height="25" />
                        <img src="{$path}views/img/jcb.png" alt="JCB" width="40" height="25" />
                </a>
        </div>
{/if}

Pas de changement.

Link to comment
Share on other sites

Par contre j'ai ça qui s'affiche sur le bas de la page principale : 

object(Link)#65 (6) { ["allow":protected]=> int(1) ["url":protected]=> string(10) "/index.php" ["protocol_link"]=> string(8) "https://" ["protocol_content"]=> string(8) "https://" ["ssl_enable":protected]=> string(1) "1" ["urlShopId":protected]=> NULL }

EDIT : Pour info le serveur renvoie bien une erreur 500

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

Ok, donc $link est bien un objet au départ mais sur votre page commande un module tiers doit écraser la variable $link

Pour savoir ce qu'elle contient, commentez le bloc qui suit (pour pouvoir voir sa valeur sans partir en erreur)

{var_dump($link)}
{*if isset($cms_payment_logo) && $cms_payment_logo}
        <div id="payment_logo_block_left" class="payment_logo_block col-lg-4 col-md-12">
        <span>Payment</span>
                <a href="{$link->getCMSLink($cms_payment_logo)|escape:'html'}">
                        <img src="{$path}views/img/visa.png" alt="Visa" width="40" height="25" />
                        <img src="{$path}views/img/mastercard.png" alt="Mastercard" width="40" height="25" />
                        <img src="{$path}views/img/paypal.png" alt="Paypal" width="40" height="25" />
                        <img src="{$path}views/img/amex.png" alt="American Express" width="40" height="25" />
                        <img src="{$path}views/img/discover.png" alt="Discover" width="40" height="25" />
                        <img src="{$path}views/img/jcb.png" alt="JCB" width="40" height="25" />
                </a>
        </div>
{/if*}

 

Link to comment
Share on other sites

Oups... mais non, c'est la variable $cms_payment_logo qui ne doit pas être bonne.

$link->getCMSLink() attend un id ou un objet. Là j'ai l'impression que vous envoyez autre chose...

Le code du module dit qu'on envoie normalement l'objet CMS correspondant et définit dans le module blockpaymentlogo:

			$cms = new CMS(Configuration::get('PS_PAYMENT_LOGO_CMS_ID'), $this->context->language->id);
			if (!Validate::isLoadedObject($cms))
				return;
			$this->smarty->assign('cms_payement_logo', $cms);

 

Link to comment
Share on other sites

Résultat

Quote

string(67) "https://monsite.com/content/16-aeu-legal-shipping-and-payment"

Bon là effectivement... Péril en la demeure.

Du coup je suis allé vérifier dans les "pages" et j'ai ça

image.thumb.png.cde101de4855af9e724ab31bc0360565.png

Je ne sais pas d'où sortes ces pages "toutes pétées" de null part ni à quoi elles ce sont rattachées ni comment.

Link to comment
Share on other sites

En faisant apparaître le contenu de cms_payement_logo j'ai eu ça

object(CMS)#971 (32) { ["id"]=> int(1) ["id_cms"]=> string(1) "1" ["head_seo_title"]=> string(0) "" ["meta_title"]=> string(9) "Livraison" ["meta_description"]=> string(27) "Nos conditions de livraison" ["meta_keywords"]=> string(50) "conditions, livraison, délais, expédition, colis" ["content"]=> string(1195) "

Je vais checker le reste.

Link to comment
Share on other sites

Le code du module

$cms = new CMS(Configuration::get('RV_PAYMENT_LOGO_CMS_ID'), $this->context->language->id);
                if (!Validate::isLoadedObject($cms)) {
                        return;
                }

        return array(
            'cms_payment_logo' => $cms,
            'path' => $this->_path,
        );

RV correspond au module du theme que j'ai installé et personnalisé si je ne dit pas de bêtise.

Par ailleurs, en modifiant le cms par 'PS_', et réactivant wishlist je n'ai plus de problème. Wishlist ne semble pas en cause mais simplement impacté par ce module  rvpaymentlogo du theme acheté... Après comment résoudre tout ça...

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

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...