Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Dec 2011
    Posts
    41
    Plugin Contributions
    0

    Default PHP Warning: str_repeat() expects exactly 2 parameters,

    Hi, when I look into public_html/cache, i noticed this


    [28-Feb-2012 10:01:19] PHP Warning: str_repeat() expects exactly 2 parameters, 1 given in /public_html/includes/templates/my_template/templates/tpl_modules_products_all_listing.php on line 129


    this is the line concerned

    Code:
    $display_products_price = TEXT_PRICE . $products_price .'<div >'. str_repeat(substr(PRODUCT_ALL_LIST_PRICE, 3, 1)) . (zen_get_show_product_switch($products_all->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($products_all->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '' : '') : '');

    what must be wrong there?

    Thanks

  2. #2
    Join Date
    Oct 2006
    Posts
    60
    Plugin Contributions
    0

    Default Re: PHP Warning: str_repeat() expects exactly 2 parameters,

    str_repeat(substr(PRODUCT_ALL_LIST_PRICE, 3, 1)) is only passing one parameter. str_repeat needs a second parameter to tell it how many times you want the first param repeated. What are you trying to accomplish?

  3. #3
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: PHP Warning: str_repeat() expects exactly 2 parameters,

    Right. Whatever you've done to hack that file up, you've deleted things that must not be deleted entirely.

    Here's the original line:
    Code:
      $display_products_price = TEXT_PRICE . ' ' . $products_price . str_repeat('<br clear="all" />', substr(PRODUCT_ALL_LIST_PRICE, 3, 1)) . (zen_get_show_product_switch($products_all->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($products_all->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '') : '');
    If you're going to remove things, take care not to break the code in the process. If you don't want the <br> tag, then at least leave an empty string, instead of completely deleting it and breaking the PHP code.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Dec 2011
    Posts
    41
    Plugin Contributions
    0

    Default Re: PHP Warning: str_repeat() expects exactly 2 parameters,

    Quote Originally Posted by DrByte View Post
    Right. Whatever you've done to hack that file up, you've deleted things that must not be deleted entirely.

    Here's the original line:
    Code:
      $display_products_price = TEXT_PRICE . ' ' . $products_price . str_repeat('<br clear="all" />', substr(PRODUCT_ALL_LIST_PRICE, 3, 1)) . (zen_get_show_product_switch($products_all->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($products_all->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '') : '');
    If you're going to remove things, take care not to break the code in the process. If you don't want the <br> tag, then at least leave an empty string, instead of completely deleting it and breaking the PHP code.

    I didnt modify anything here,I just notice it when I went to public_html/cache.

  5. #5
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: PHP Warning: str_repeat() expects exactly 2 parameters,

    Okay, then whoever DID modify it did it incorrectly.
    Contact them for assistance.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. v153 PHP Warning - STR_REPEAT
    By GeoBew in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 30 Jul 2015, 01:32 PM
  2. v153 PHP Warning: addslashes() expects parameter 1 to be string
    By BlackOrchidCouture in forum General Questions
    Replies: 2
    Last Post: 17 Sep 2014, 10:47 PM
  3. Replies: 9
    Last Post: 20 Jan 2014, 09:21 PM
  4. Replies: 2
    Last Post: 20 Jan 2014, 07:21 PM
  5. v150 PHP Warning: explode() expects at most 3 parameters
    By ray-the-otter in forum General Questions
    Replies: 6
    Last Post: 8 Oct 2012, 02:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg