202-ecommerce / stripe_official

After years of hard work with Stripe connector for PrestaShop, 202 ecommerce stop the development of Stripe module on January 9th 2023. Thanks for all contributors that help us!
20 stars 20 forks source link

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

Closed HartLarsson closed 1 year ago

HartLarsson commented 1 year ago

We have the error_log_php full of errors like that:

[20-Dec-2022 11:38:58 Europe/Rome] PHP Fatal error:  Uncaught Error: Call to a member function getModuleLink() on string in /home2/userxxx/public_html/var/cache/prod/smarty/compile/warehousechild/ce/8f/f7/ce8ff79e11cd645f0c04c68abbbba935458da99c_2.file.my-account-stripe-cards.tpl.php:26
Stack trace:
#0 /home2/userxxx/public_html/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_63a08113615c20_14844328(Object(Smarty_Internal_Template))
#1 /home2/userxxx/public_html/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(Smarty_Internal_Template))
#2 /home2/userxxx/public_html/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render(Object(Smarty_Internal_Template))
#3 /home2/userxxx/public_html/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(232): Smarty_Internal_Template->render(false, 0)
#4 /home2/userxxx/public_html/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templ in /home2/userxxx/public_html/var/cache/prod/smarty/compile/warehousechild/ce/8f/f7/ce8ff79e11cd645f0c04c68abbbba935458da99c_2.file.my-account-stripe-cards.tpl.php on line 26

Prestashop 1.7.8.7 PHP7.4 Theme Warehouse 4.5.5 Stripe Module v2.5.0

No chache activated only CCC parameters ON

this is the part of the code (line 26) that gave error:

function content_63a1a0daa2ddf7_67275065 (Smarty_Internal_Template $_smarty_tpl) {
if ($_smarty_tpl->tpl_vars['isSaveCard']->value) {?>
  <?php if ($_smarty_tpl->tpl_vars['prestashop_version']->value == '1.7') {?>
(===> 26)      <a class="col-lg-4 col-md-6 col-sm-6 col-xs-12" href="<?php echo htmlspecialchars(call_user_func_array($_smarty_tpl->registered_plugins[ 'modifier' ][ 'escape' ][ 0 ], array( $_smarty_tpl->tpl_vars['link']->value->getModuleLink('stripe_official','stripeCards'),'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 cards','mod'=>'stripe_official'),$_smarty_tpl ) );?>
">
          <span class="link-item">
              <i class="material-icons md-36">payment</i>
              <?php echo call_user_func_array( $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'My cards','mod'=>'stripe_official'),$_smarty_tpl ) );?>

          </span>
      </a>
  <?php } else { ?>
      <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('stripe_official','stripeCards'),'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 cards','mod'=>'stripe_official'),$_smarty_tpl ) );?>
">
              <i class="icon-credit-card"></i>
              <span><?php echo call_user_func_array( $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'My cards','mod'=>'stripe_official'),$_smarty_tpl ) );?>
</span>
          </a>
      </li>
  <?php }
}
}

Any help will be great :)

clotairer commented 1 year ago

Hello,

you probably have a module that assign the same variable than Stripe module. If you follow the compiled template line 26, you’ll found the variable name and can look for it in your module directory.

HartLarsson commented 1 year ago

@clotairer this is the line 26

<a class="col-lg-4 col-md-6 col-sm-6 col-xs-12" href="<?php echo htmlspecialchars(call_user_func_array($_smarty_tpl->registered_plugins[ 'modifier' ][ 'escape' ][ 0 ], array( $_smarty_tpl->tpl_vars['link']->value->getModuleLink('stripe_official','stripeCards'),'html','UTF-8' )), ENT_QUOTES, 'UTF-8');?>

is stripe

clotairer commented 1 year ago

I think you have somewhere an other assignation of var 'link' on smarty that is in conflict with Stripe assignation. The link from Stripe is an object and in an other assignation a string.

HartLarsson commented 1 year ago

this is the full file:

<?php
/* Smarty version 3.1.43, created on 2022-12-22 15:50:21
  from '/home2/userxxx/public_html/modules/stripe_official/views/templates/hook/my-account-stripe-cards.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '3.1.43',
  'unifunc' => 'content_63a46ead20f6f5_74488283',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    'ce8ff79e11cd645f0c04c68abbbba935458da99c' => 
    array (
      0 => '/home2/userxxx/public_html/modules/stripe_official/views/templates/hook/my-account-stripe-cards.tpl',
      1 => 1671533087,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
  ),
),false)) {
function content_63a46ead20f6f5_74488283 (Smarty_Internal_Template $_smarty_tpl) {
if ($_smarty_tpl->tpl_vars['isSaveCard']->value) {?>
  <?php if ($_smarty_tpl->tpl_vars['prestashop_version']->value == '1.7') {?>
      <a class="col-lg-4 col-md-6 col-sm-6 col-xs-12" href="<?php echo htmlspecialchars(call_user_func_array($_smarty_tpl->registered_plugins[ 'modifier' ][ 'escape' ][ 0 ], array( $_smarty_tpl->tpl_vars['link']->value->getModuleLink('stripe_official','stripeCards'),'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 cards','mod'=>'stripe_official'),$_smarty_tpl ) );?>
">
          <span class="link-item">
              <i class="material-icons md-36">payment</i>
              <?php echo call_user_func_array( $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'My cards','mod'=>'stripe_official'),$_smarty_tpl ) );?>

          </span>
      </a>
  <?php } else { ?>
      <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('stripe_official','stripeCards'),'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 cards','mod'=>'stripe_official'),$_smarty_tpl ) );?>
">
              <i class="icon-credit-card"></i>
              <span><?php echo call_user_func_array( $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'My cards','mod'=>'stripe_official'),$_smarty_tpl ) );?>
</span>
          </a>
      </li>
  <?php }
}
}
}

how i can find out the double assignation? seems very strange

clotairer commented 1 year ago

Do you have somewhere a module with $smarty->assign(‘link’, ´coco’);

HartLarsson commented 1 year ago

Do you have somewhere a module with $smarty->assign(‘link’, ´coco’);

nope i've checked :(

clotairer commented 1 year ago

Could you comment this line: https://github.com/202-ecommerce/stripe_official/blob/develop/stripe_official.php#L1036

And tell send me the back-trace of the error.

clotairer commented 1 year ago

oh no... this assignation is in getContent() of the backoffice configuration page.

clotairer commented 1 year ago

this is in this front controller > https://github.com/202-ecommerce/stripe_official/blob/develop/controllers/front/stripeCards.php Could you please try to add this piece of code at line 33 (or 53) ?

        $this->context->smarty->assign([
            'link' => new Link(),
        ]);
202-ecommerce commented 1 year ago

After years of hard work with Stripe connector for PrestaShop, 202 ecommerce will stop developping Stripe module on January 9th 2023. After this date, merchants will get support directly

HartLarsson commented 1 year ago

After years of hard work with Stripe connector for PrestaShop, 202 ecommerce will stop developping Stripe module on January 9th 2023. After this date, merchants will get support directly

That means that Stripe release their official module?

HartLarsson commented 1 year ago

this is in this front controller > https://github.com/202-ecommerce/stripe_official/blob/develop/controllers/front/stripeCards.php Could you please try to add this piece of code at line 33 (or 53) ?

        $this->context->smarty->assign([
            'link' => new Link(),
        ]);

image

exactly where? because is not clear?

clotairer commented 1 year ago

Line 51 you have an other assignation. Just before, it sould be great.

Stripe decided to stop the partnership with 202 ecommerce to manage the development and the support of this module. They choose an new partner to follow the development with probably new ambitions !

HartLarsson commented 1 year ago

Line 51 you have an other assignation. Just before, it sould be great.

Stripe decided to stop the partnership with 202 ecommerce to manage the development and the support of this module. They choose an new partner to follow the development with probably new ambitions !

i'm really terrified abotu this idea, i had great results with your works and support was always very fast and right. We will see what we will get :(

returning on the code i will try do add there:

image

I will do a test to see if the error continue