Jump to content

PS 1.7.8.11 ContextErrorException sur page panier (RESOLU)


Recommended Posts

Posted (edited)


Bonjour,
Je me permets de poster ma demande ici, concernant une erreur 500 en mode Debug uniquement, sur la page panier (pas d'impact sur le fonctionnement à priori en mode "normal").
Je suis sur un Prestashop 1.7.8.11, PHP 7.4 (le bug n'est pas présent avec PHP 7.3), voici le détail de l'erreur :

(1/1) ContextErrorException
Notice: Trying to access array offset on value of type null

in 7ef2c096b2f1ecb6d7d709d6bb492069014e16ff_2.file.cart-detailed-totals.tpl.php line 85
at Block_1333018932664c8c7121b752_80457601->callBlock(object(SmartyDevTemplate))
in smarty_internal_runtime_inheritance.php line 248
at Smarty_Internal_Runtime_Inheritance->callBlock(object(Block_1333018932664c8c7121b752_80457601), object(SmartyDevTemplate))
in smarty_internal_runtime_inheritance.php line 184
at Smarty_Internal_Runtime_Inheritance->process(object(SmartyDevTemplate), object(Block_1333018932664c8c7121b752_80457601))
in smarty_internal_runtime_inheritance.php line 156
at Smarty_Internal_Runtime_Inheritance->instanceBlock(object(SmartyDevTemplate), 'Block_1333018932664c8c7121b752_80457601', 'cart_detailed_totals')
in 7ef2c096b2f1ecb6d7d709d6bb492069014e16ff_2.file.cart-detailed-totals.tpl.php line 28
at content_664c8c71224f86_73190409(object(SmartyDevTemplate))
in smarty_template_resource_base.php line 123
at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))
in smarty_template_compiled.php line 114
at Smarty_Template_Compiled->render(object(SmartyDevTemplate))
in smarty_internal_template.php line 216
at Smarty_Internal_Template->render()
in smarty_internal_template.php line 385
at Smarty_Internal_Template->_subTemplateRender('file:checkout/_partials/cart-detailed-totals.tpl', null, 'blck-childlayouts/layout-full-width.tpl', 0, 3600, array('cart' => array('products' => array(), 'totals' => array('total' => array('type' => 'total', 'label' => 'Total', 'amount' => 0.0, 'value' => '0,00 €'), 'total_including_tax' => array('type' => 'total', 'label' => 'Total TTC', 'amount' => 0.0, 'value' => '0,00 €'), 'total_excluding_tax' => array('type' => 'total', 'label' => 'Total HT :', 'amount' => 0.0, 'value' => '0,00 €')), 'subtotals' => array('products' => array('type' => 'products', 'label' => 'Sous-total', 'amount' => 0.0, 'value' => '0,00 €'), 'discounts' => null, 'shipping' => array('type' => 'shipping', 'label' => 'Livraison', 'amount' => 0, 'value' => ''), 'tax' => null), 'products_count' => 0, 'summary_string' => '0 articles', 'labels' => array('tax_short' => '(HT)', 'tax_long' => '(hors taxe)'), 'id_address_delivery' => '0', 'id_address_invoice' => '0', 'is_virtual' => false, 'vouchers' => array('allowed' => 1, 'added' => array()), 'discounts' => array(), 'minimalPurchase' => 0.0, 'minimalPurchaseRequired' => '')), 0, false)
in c9def0ab2f7e3b62956c3e0626d7291f9b350825_2.file.cart.tpl.php line 95
at Block_203435785664c8c7116bbf0_43734257->callBlock(object(SmartyDevTemplate))
in smarty_internal_runtime_inheritance.php line 248
at Smarty_Internal_Runtime_Inheritance->callBlock(object(Block_203435785664c8c7116bbf0_43734257), object(SmartyDevTemplate))
in smarty_internal_runtime_inheritance.php line 184
at Smarty_Internal_Runtime_Inheritance->process(object(SmartyDevTemplate), object(Block_203435785664c8c7116bbf0_43734257))
in smarty_internal_runtime_inheritance.php line 156
at Smarty_Internal_Runtime_Inheritance->instanceBlock(object(SmartyDevTemplate), 'Block_203435785664c8c7116bbf0_43734257', 'cart_totals', 1)
in c9def0ab2f7e3b62956c3e0626d7291f9b350825_2.file.cart.tpl.php line 127
at Block_682516091664c8c7116b006_87208475->callBlock(object(SmartyDevTemplate))
in smarty_internal_runtime_inheritance.php line 248
at Smarty_Internal_Runtime_Inheritance->callBlock(object(Block_682516091664c8c7116b006_87208475), object(SmartyDevTemplate))
in smarty_internal_runtime_inheritance.php line 184
at Smarty_Internal_Runtime_Inheritance->process(object(SmartyDevTemplate), object(Block_682516091664c8c7116b006_87208475))
in smarty_internal_runtime_inheritance.php line 156
at Smarty_Internal_Runtime_Inheritance->instanceBlock(object(SmartyDevTemplate), 'Block_682516091664c8c7116b006_87208475', 'cart_summary', 1)
in c9def0ab2f7e3b62956c3e0626d7291f9b350825_2.file.cart.tpl.php line 234
at Block_826054219664c8c7115fe35_96609729->callBlock(object(SmartyDevTemplate))
in smarty_internal_runtime_inheritance.php line 248
at Smarty_Internal_Runtime_Inheritance->callBlock(object(Block_826054219664c8c7115fe35_96609729), object(SmartyDevTemplate))
in smarty_internal_runtime_inheritance.php line 232
at Smarty_Internal_Runtime_Inheritance->callParent(object(SmartyDevTemplate), object(Block_1920229007664c8d89c3e2f8_32851740), '\'{block append}\'')
in smarty_internal_runtime_inheritance.php line 181
at Smarty_Internal_Runtime_Inheritance->process(object(SmartyDevTemplate), object(Block_1920229007664c8d89c3e2f8_32851740), object(Block_826054219664c8c7115fe35_96609729))
in smarty_internal_runtime_inheritance.php line 186
at Smarty_Internal_Runtime_Inheritance->process(object(SmartyDevTemplate), object(Block_826054219664c8c7115fe35_96609729), object(Block_856577602664c8b05d38b57_68375243))
in smarty_internal_runtime_inheritance.php line 186
at Smarty_Internal_Runtime_Inheritance->process(object(SmartyDevTemplate), object(Block_856577602664c8b05d38b57_68375243))
in smarty_internal_runtime_inheritance.php line 156
at Smarty_Internal_Runtime_Inheritance->instanceBlock(object(SmartyDevTemplate), 'Block_856577602664c8b05d38b57_68375243', 'content', 2)
in 8230e52fd16e9d763ac2bc2f84470f893fdcf541_2.file.layout-full-width.tpl.php line 117
at Block_458293273664c8b05d37e97_76835920->callBlock(object(SmartyDevTemplate))
in smarty_internal_runtime_inheritance.php line 248
at Smarty_Internal_Runtime_Inheritance->callBlock(object(Block_458293273664c8b05d37e97_76835920), object(SmartyDevTemplate))
in smarty_internal_runtime_inheritance.php line 184
at Smarty_Internal_Runtime_Inheritance->process(object(SmartyDevTemplate), object(Block_458293273664c8b05d37e97_76835920), object(Block_1221232293664c8b05d53d35_83652891))
in smarty_internal_runtime_inheritance.php line 186
at Smarty_Internal_Runtime_Inheritance->process(object(SmartyDevTemplate), object(Block_1221232293664c8b05d53d35_83652891))
in smarty_internal_runtime_inheritance.php line 156
at Smarty_Internal_Runtime_Inheritance->instanceBlock(object(SmartyDevTemplate), 'Block_1221232293664c8b05d53d35_83652891', 'content_wrapper', 7)
in dcebbdfdb7e331c9f0a1e580e3c8f04266dcd9a5_2.file.layout-both-columns.tpl.php line 686
at Block_1955304978664c8b05d50816_17070876->callBlock(object(SmartyDevTemplate))
in smarty_internal_runtime_inheritance.php line 248
at Smarty_Internal_Runtime_Inheritance->callBlock(object(Block_1955304978664c8b05d50816_17070876), object(SmartyDevTemplate))
in smarty_internal_runtime_inheritance.php line 184
at Smarty_Internal_Runtime_Inheritance->process(object(SmartyDevTemplate), object(Block_1955304978664c8b05d50816_17070876))
in smarty_internal_runtime_inheritance.php line 156
at Smarty_Internal_Runtime_Inheritance->instanceBlock(object(SmartyDevTemplate), 'Block_1955304978664c8b05d50816_17070876', 'wrapper')
in dcebbdfdb7e331c9f0a1e580e3c8f04266dcd9a5_2.file.layout-both-columns.tpl.php line 179
at content_664c8b05d5b485_77310198(object(SmartyDevTemplate))
in smarty_template_resource_base.php line 123
at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))
in smarty_template_compiled.php line 114
at Smarty_Template_Compiled->render(object(SmartyDevTemplate))
in smarty_internal_template.php line 216
at Smarty_Internal_Template->render()
in smarty_internal_template.php line 385
at Smarty_Internal_Template->_subTemplateRender('layouts/layout-both-columns.tpl', null, 'blck-childlayouts/layout-full-width.tpl', 0, 3600, array(), 2, false, null, null)
in smarty_internal_runtime_inheritance.php line 116
at Smarty_Internal_Runtime_Inheritance->endChild(object(SmartyDevTemplate), 'layouts/layout-both-columns.tpl')
in 8230e52fd16e9d763ac2bc2f84470f893fdcf541_2.file.layout-full-width.tpl.php line 42
at content_664c8b05d39607_88952130(object(SmartyDevTemplate))
in smarty_template_resource_base.php line 123
at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))
in smarty_template_compiled.php line 114
at Smarty_Template_Compiled->render(object(SmartyDevTemplate))
in smarty_internal_template.php line 216
at Smarty_Internal_Template->render()
in smarty_internal_template.php line 385
at Smarty_Internal_Template->_subTemplateRender('layouts/layout-full-width.tpl', null, 'blck-childlayouts/layout-full-width.tpl', 0, 3600, array(), 2, false, null, null)
in smarty_internal_runtime_inheritance.php line 116
at Smarty_Internal_Runtime_Inheritance->endChild(object(SmartyDevTemplate), 'layouts/layout-full-width.tpl')
in c9def0ab2f7e3b62956c3e0626d7291f9b350825_2.file.cart.tpl.php line 36
at content_664c8c7116db16_38379270(object(SmartyDevTemplate))
in smarty_template_resource_base.php line 123
at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))
in smarty_template_compiled.php line 114
at Smarty_Template_Compiled->render(object(SmartyDevTemplate))
in smarty_internal_template.php line 216
at Smarty_Internal_Template->render()
in smarty_internal_template.php line 385
at Smarty_Internal_Template->_subTemplateRender('checkout/cart.tpl', null, 'blck-childlayouts/layout-full-width.tpl', 0, 3600, array(), 2, false, null, null)
in smarty_internal_runtime_inheritance.php line 116
at Smarty_Internal_Runtime_Inheritance->endChild(object(SmartyDevTemplate), 'checkout/cart.tpl')
in d183720ff5d4a77add032730f0550e5fd46dedd1_2.file.cart-empty.tpl.php line 56
at content_664c8d89c43697_12334335(object(SmartyDevTemplate))
in smarty_template_resource_base.php line 123
at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))
in smarty_template_compiled.php line 114
at Smarty_Template_Compiled->render(object(SmartyDevTemplate))
in smarty_internal_template.php line 216
at Smarty_Internal_Template->render(false, 0)
in smarty_internal_templatebase.php line 232
at Smarty_Internal_TemplateBase->_execute(object(SmartyDevTemplate), null, 'blck-childlayouts/layout-full-width.tpl', null, 0)
in smarty_internal_templatebase.php line 116
at Smarty_Internal_TemplateBase->fetch('checkout/cart-empty.tpl', null, 'blck-childlayouts/layout-full-width.tpl', null, false, true, false)
in SmartyDev.php line 40
at SmartyDev->fetch('checkout/cart-empty.tpl', null, 'blck-childlayouts/layout-full-width.tpl')
in FrontController.php line 727
at FrontControllerCore->smartyOutputContent('checkout/cart-empty.tpl')
in FrontController.php line 709
at FrontControllerCore->display()
in Controller.php line 326
at ControllerCore->run()
in Dispatcher.php line 525
at DispatcherCore->dispatch()
in index.php line 28

Auriez-vous une piste de l'endroit ou chercher l'erreur ? 
Merci beaucoup.

Ps : voici le lien vers ma page panier 

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

Posted (edited)

J'ai identifié le fichier qui cause à priori le bug sous PHP 7.4 (pas de soucis sous PHP 7.3) (j'ai remplacé mes fichiers du thème un par un jusqu'à trouver celui qui déclenche l'erreur en mode debug), voici sa composition (cart-detailed-totals.tpl) :

{**
													  
 * 2007-2017 PrestaShop
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License 3.0 (AFL-3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/AFL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to [email protected] so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to http://www.prestashop.com for more information.
 *
 * @author    PrestaShop SA <contact@prestashop.com>
 * @copyright 2007-2017 PrestaShop SA
 * @license   https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
 * International Registered Trademark & Property of PrestaShop SA
 *}
{block name='cart_detailed_totals'}
<div class="cart-detailed-totals">

  <div class="">
    {foreach from=$cart.subtotals item="subtotal"}
      {if $subtotal.value && $subtotal.type !== 'tax'}
        <div class="cart-summary-line" id="cart-subtotal-{$subtotal.type}">
          <span class="label{if 'products' === $subtotal.type} js-subtotal{/if}">
            {if 'products' == $subtotal.type}
              {$cart.summary_string}
            {else}
              {$subtotal.label}
            {/if}
          </span>
          <div>
          <span class="value">
              {if 'discount' == $subtotal.type}-&nbsp;{/if}{$subtotal.value}
          </span>
          {if $subtotal.type === 'shipping'}
              <small class="value">{hook h='displayCheckoutSubtotalDetails' subtotal=$subtotal}</small>
          {/if}
          </div>
        </div>
      {/if}
    {/foreach}
  </div>

  {block name='cart_summary_totals'}
      {include file='checkout/_partials/cart-summary-totals.tpl' cart=$cart}
  {/block}
  <hr class="separator mt-0">

    {block name='cart_voucher'}
    {include file='checkout/_partials/cart-voucher.tpl'}
  {/block}
</div>

{/block}

Si quelqu'un saurait me dire si l'incompatibilité avec PHP 7.4 vient d'un élément de ce fichier, merci beaucoup, si je retire ce passage, je n'ai plus d'erreur sur ma page panier
 

{foreach from=$cart.subtotals item="subtotal"}
      {if $subtotal.value && $subtotal.type !== 'tax'}
        <div class="cart-summary-line" id="cart-subtotal-{$subtotal.type}">
          <span class="label{if 'products' === $subtotal.type} js-subtotal{/if}">
            {if 'products' == $subtotal.type}
              {$cart.summary_string}
            {else}
              {$subtotal.label}
            {/if}
          </span>
          <div>
          <span class="value">
              {if 'discount' == $subtotal.type}-&nbsp;{/if}{$subtotal.value}
          </span>
          {if $subtotal.type === 'shipping'}
              <small class="value">{hook h='displayCheckoutSubtotalDetails' subtotal=$subtotal}</small>
          {/if}
          </div>
        </div>
      {/if}
    {/foreach}

Merci

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

Je pense avoir trouvé la réponse en comparant avec le fichier cart-detailed-totals.tpl du thème d'origine (prestashop 1.7.8.11), j'ai remplacé cette ligne dans mon fichier du thème BLCK v4.0.0 :

{if $subtotal.value && $subtotal.type !== 'tax'}

par la ligne du fichier du thème Classic (v1.7.8.11) :
 

{if $subtotal && $subtotal.value|count_characters > 0 && $subtotal.type !== 'tax'}

Cela semble fonctionner en site local sous PHP 7.4, je continue mes tests voir si cela cause un soucis ailleurs.

Link to comment
Share on other sites

  • gouna changed the title to PS 1.7.8.11 ContextErrorException sur page panier (RESOLU)

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