Jump to content

PHP Warning: htmlspecialchars() expects parameter 1 to be string, array given in


vxmretail

Recommended Posts

 

Hi,

I see a problem in my error log:

[28-Feb-2021 17:56:34 Europe/Amsterdam] PHP Warning:  htmlspecialchars() expects parameter 1 to be string, array given in /home/XXX/public_html/var/cache/prod/smarty/compile/warehouselayouts_layout_full_width_tpl/a4/5e/c8/a45ec8b6e41f76c7af2e5ff1fb03cffacfb2ee57_2.file.product-prices.tpl.php on line 226
 

Line 226:

<span class="current-price"><span itemprop="price" class="product-price" content="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['rounded_display_price'], ENT_QUOTES, 'UTF-8');?>
"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['price'], ENT_QUOTES, 'UTF-8');?>

This is my product-prices.tpl file

{**
 * 2007-2017 PrestaShop
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 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:
 * http://opensource.org/licenses/osl-3.0.php
 * 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   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
 * International Registered Trademark & Property of PrestaShop SA
 *}



    <div class="product-prices">
        {block name='product_reference'}
            {if $iqitTheme.pp_reference == 'title'}
            {if isset($product.reference_to_display) && $product.reference_to_display neq ''}
                <div class="product-reference">
                    <label class="label">{l s='Reference' d='Shop.Theme.Catalog'} </label>                    <span itemprop="sku">{$product.reference_to_display}</span>					<br />					<label class="label">{l s='Ean13' d='Shop.Theme.Catalog'}:</label>					<span itemprop="gtin13" content="{$product.ean13}">{$product.ean13}</span>
                </div>
            {/if}
            {/if}
        {/block}



        {if $product.show_price}
        {if !$configuration.is_catalog}
            {block name='product_availability'}
                {if $product.show_availability && $product.availability_message}
                    <span id="product-availability"
                          class="badge {if $product.availability == 'available'} {if $product.quantity <= 0  && !$product.allow_oosp} badge-danger product-unavailable  {elseif $product.quantity <= 0  && $product.allow_oosp}badge-warning product-unavailable-allow-oosp {else}badge-success product-available{/if}{elseif $product.availability == 'last_remaining_items'}badge-warning product-last-items{else}badge-danger product-unavailable{/if}">
                  {if $product.availability == 'available'}
                      <i class="fa fa-check rtl-no-flip" aria-hidden="true"></i>
                                                     {$product.availability_message}
                  {elseif $product.availability == 'last_remaining_items'}
                      <i class="fa fa-exclamation" aria-hidden="true"></i>
                                                     {$product.availability_message}
                  {else}
                      <i class="fa fa-ban" aria-hidden="true"></i>
                              {$product.availability_message}
                      {if isset($product.available_date) && $product.available_date != '0000-00-00'}
                      {if $product.available_date|strtotime > $smarty.now}<span
                              class="available-date">{l s='until' d='Shop.Theme.Catalog'} {$product.available_date}</span>{/if}
                  {/if}
                  {/if}
                </span>
                {/if}
            {/block}
        {/if}


        {block name='product_price'}
            <div class="{if $product.has_discount}has-discount{/if}"
                 itemprop="offers"
                 itemscope
                 itemtype="https://schema.org/Offer"
            >

                {if isset($product.seo_availability)}
                    <link itemprop="availability" href="{$product.seo_availability}"/>
                {else}
                    <link itemprop="availability" href="https://schema.org/InStock"/>
                {/if}
                <meta itemprop="priceCurrency" content="{$currency.iso_code}">
                <meta itemprop="url" content="{$product.url}">


                <div>
                    <span itemprop="price" class="product-price" content="{$product.rounded_display_price}">{$product.price}</span>
                    {if $product.has_discount}
                        <span class="product-discount">
                            {hook h='displayProductPriceBlock' product=$product type="old_price"}
                            <span class="regular-price">{$product.regular_price}</span>
                         </span>

                        {if $product.discount_type === 'percentage'}
                            <span class="badge badge-discount discount discount-percentage">-{$product.discount_percentage_absolute}</span>
                        {else}
                            <span class="badge badge-discount discount discount-amount">-{$product.discount_to_display}</span>
                        {/if}

                        {if isset($product.specific_prices.to) && $product.specific_prices.to != '0000-00-00 00:00:00'}<meta itemprop="priceValidUntil" content="{$product.specific_prices.to}"/>{/if}

                    {/if}
                </div>
				                {block name='product_unit_price'}
                    {if $displayUnitPrice}
                        <p class="product-unit-price text-muted">{l s='(%unit_price%)' d='Shop.Theme.Catalog' sprintf=['%unit_price%' => $product.unit_price_full]}</p>
                    {/if}
                {/block}
            </div>
        {/block}

        {block name='product_without_taxes'}
            {if $priceDisplay == 2}
                <p class="product-without-taxes text-muted">{l s='%price% tax excl.' d='Shop.Theme.Catalog' sprintf=['%price%' => $product.price_tax_exc]}</p>
            {/if}
        {/block}

        {block name='product_pack_price'}
            {if $displayPackPrice}
                <p class="product-pack-price">
                    <span>{l s='Instead of %price%' d='Shop.Theme.Catalog' sprintf=['%price%' => $noPackPrice]}</span>
                </p>
            {/if}
        {/block}

        {block name='product_ecotax'}
            {if $product.ecotax.amount > 0}
                <p class="price-ecotax text-muted">{l s='Including %amount% for ecotax' d='Shop.Theme.Catalog' sprintf=['%amount%' => $product.ecotax.value]}
                    {if $product.has_discount}
                        {l s='(not impacted by the discount)' d='Shop.Theme.Catalog'}
                    {/if}
                </p>
            {/if}
        {/block}

        {hook h='displayProductPriceBlock' product=$product type="weight" hook_origin='product_sheet'}

        <div class="tax-shipping-delivery-label text-muted">
            {if isset($configuration.taxes_enabled) && !$configuration.taxes_enabled}
                {l s='No tax' d='Shop.Theme.Catalog'}
            {elseif $configuration.display_taxes_label}
                {$product.labels.tax_long}
            {/if}
            {hook h='displayProductPriceBlock' product=$product type="price"}
            {hook h='displayProductPriceBlock' product=$product type="after_price"}
            {if $product.additional_delivery_times == 1}
                {if $product.delivery_information}
                    <span class="delivery-information">{$product.delivery_information}</span>
                {/if}
            {elseif $product.additional_delivery_times == 2}
                {if $product.quantity > 0}
                    <span class="delivery-information">{$product.delivery_in_stock}</span>
                    {* Out of stock message should not be displayed if customer can't order the product. *}
                    {elseif $product.quantity <= 0 && $product.add_to_cart_url}
                    <span class="delivery-information">{$product.delivery_out_stock}</span>
                {/if}
            {/if}
        </div>
        {hook h='displayCountDown'}
        {/if}		
    </div>

Does anyone know a solution?
Thanks!

 

Best Regards,

Jelte

satisfyer-wand-er-woman-white.html

Edited by vxmretail
extra info (see edit history)
Link to comment
Share on other sites

  • 2 months later...
  • 1 year later...
On 6/4/2021 at 7:19 PM, PrestaHeroes.com said:

this is a php warning, the script does not stop

if you are not having a specific issue and in debug to find solution, turn off debug mode and ignore

notices/warnings do not abend script...

Hello,

I have the same  problem.

I wish to ignore, but this generates me a error_log for 1GB every week :(

I use Presta 1.7.7.5 and PHP 7.3/

Had somebody find a solution?

Regards!

Link to comment
Share on other sites

21 hours ago, WojtLabas said:

Hello,

I have the same  problem.

I wish to ignore, but this generates me a error_log for 1GB every week :(

I use Presta 1.7.7.5 and PHP 7.3/

Had somebody find a solution?

Regards!

 

 

try this:

open this file config/defines

find @error_reporting(E_ALL | E_STRICT);  ~E_WARNING for example should stop warnings.

you can then customize error reporting that best fits your need 

https://www.php.net/manual/en/function.error-reporting.php

Link to comment
Share on other sites

On 1/9/2023 at 8:59 PM, PrestaHeroes.com said:

 

 

try this:

open this file config/defines

find @error_reporting(E_ALL | E_STRICT);  ~E_WARNING for example should stop warnings.

you can then customize error reporting that best fits your need 

https://www.php.net/manual/en/function.error-reporting.php

Hello,

Thank you. I tried even set to:

@error_reporting(0);

but this errors are shown in new log file again. (var/cache cleared)

Regards

Link to comment
Share on other sites

  • 4 weeks later...

I think it solves problem, if it comes from product-prices.tpl

 

I have errors according to two other files:

1: Line 44 in productGrid2.tpl (it is empty line in my file)

Quote

40 <div class="item">
41 <div itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
42 {if isset($position)}<meta itemprop="position" content="{$position}" />{/if}    
43 <article class="product-miniature js-product-miniature" data-id-product="{$product.id_product}" data-id-product-attribute="{$product.id_product_attribute}" itemscope itemtype="http://schema.org/Product">
44
45  <div class="laberProduct-container">
46     <div class="laberProduct-image">
47       {block name='product_thumbnail'}
48       {if $product.cover}
49         <a href="{$product.url}" class="thumbnail product-thumbnail">
50                <span class="cover_image">

 

And second file:

productList.tpl on line 34:

Quote

31 <article class="product-miniature js-product-miniature" data-id-product="{$product.id_product}" data-id-product-attribute="{$product.id_product_attribute}" itemscope itemtype="http://schema.org/Product">
32
33 <div class="laberProduct-container item">
34      <div class="row">
35          <div class="col-lg-4 col-md-6 col-sm-12">
36             <div class="laberProduct-image">
37                {block name='product_thumbnail'}
38        {if $product.cover}

 

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