Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,871
    Plugin Contributions
    96

    Default [Duplicate] coupon_admin.php: strip_tags() expects at most 2 parameters, 4 given

    Running Zen Cart v1.5.1 on PHP 5.38. I noticed that I had the following debug-log:
    Code:
    strip_tags() expects at most 2 parameters, 4 given in C:\xampp\htdocs\mystore\myadmin\coupon_admin.php on line 641
    which translates to this code
    Code:
                  <tr>
                    <td valign="top" class="main"><?php echo TEXT_MESSAGE; ?>&nbsp;&nbsp;</td>
                    <td><?php echo zen_draw_textarea_field('message', 'soft', '60', '15', htmlspecialchars(strip_tags(($_POST['message_html']=='') ? TEXT_COUPON_ANNOUNCE : stripslashes($_POST['message_html']), ENT_COMPAT, CHARSET, TRUE))); ?></td>
                  </tr>
    It looks like the closing parentheses got misplaced when the htmlspecialchars call was updated; I believe the code should read
    Code:
                  <tr>
                    <td valign="top" class="main"><?php echo TEXT_MESSAGE; ?>&nbsp;&nbsp;</td>
                    <td><?php echo zen_draw_textarea_field('message', 'soft', '60', '15', htmlspecialchars(strip_tags(($_POST['message_html']=='') ? TEXT_COUPON_ANNOUNCE : stripslashes($_POST['message_html'])), ENT_COMPAT, CHARSET, TRUE)); ?></td>
                  </tr>

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: coupon_admin.php: strip_tags() expects at most 2 parameters, 4 given

    .

    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.

  3. #3
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,871
    Plugin Contributions
    96

    Default Re: coupon_admin.php: strip_tags() expects at most 2 parameters, 4 given

    Quote Originally Posted by DrByte View Post
    I mistakenly replied to the thread you posted; the correction apparently didn't make it into the v1.5.1 distribution (nor is it present in the v1.6.0 repository on github).

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,871
    Plugin Contributions
    96

    Default Re: coupon_admin.php: strip_tags() expects at most 2 parameters, 4 given

    Quote Originally Posted by lat9 View Post
    I mistakenly replied to the thread you posted; the correction apparently didn't make it into the v1.5.1 distribution (nor is it present in the v1.6.0 repository on github).
    I misread the code that's up in github; the correction is there (and in v1.5.2); just not in v1.5.1.

  5. #5
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,845
    Plugin Contributions
    25

    Default Re: coupon_admin.php: strip_tags() expects at most 2 parameters, 4 given

    Quote Originally Posted by lat9 View Post
    Running Zen Cart v1.5.1 on PHP 5.38. I noticed that I had the following debug-log:
    Code:
    strip_tags() expects at most 2 parameters, 4 given in C:\xampp\htdocs\mystore\myadmin\coupon_admin.php on line 641
    which translates to this code
    Code:
                  <tr>
                    <td valign="top" class="main"><?php echo TEXT_MESSAGE; ?>&nbsp;&nbsp;</td>
                    <td><?php echo zen_draw_textarea_field('message', 'soft', '60', '15', htmlspecialchars(strip_tags(($_POST['message_html']=='') ? TEXT_COUPON_ANNOUNCE : stripslashes($_POST['message_html']), ENT_COMPAT, CHARSET, TRUE))); ?></td>
                  </tr>
    It looks like the closing parentheses got misplaced when the htmlspecialchars call was updated; I believe the code should read
    Code:
                  <tr>
                    <td valign="top" class="main"><?php echo TEXT_MESSAGE; ?>&nbsp;&nbsp;</td>
                    <td><?php echo zen_draw_textarea_field('message', 'soft', '60', '15', htmlspecialchars(strip_tags(($_POST['message_html']=='') ? TEXT_COUPON_ANNOUNCE : stripslashes($_POST['message_html'])), ENT_COMPAT, CHARSET, TRUE)); ?></td>
                  </tr>
    When I look in a vanilla file-set, the second closing bracket is there. Maybe you deleted it by accident?

  6. #6
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,871
    Plugin Contributions
    96

    Default Re: coupon_admin.php: strip_tags() expects at most 2 parameters, 4 given

    Nope, when I look at the file from the v1.5.1 distribution that I downloaded on 9/18/2012, the offending lines read:
    Code:
              <tr>
                    <td valign="top" class="main"><?php echo TEXT_MESSAGE; ?>&nbsp;&nbsp;</td>
                    <td><?php echo zen_draw_textarea_field('message', 'soft', '60', '15', htmlspecialchars(strip_tags(($_POST['message_html']=='') ? TEXT_COUPON_ANNOUNCE : stripslashes($_POST['message_html']), ENT_COMPAT, CHARSET, TRUE))); ?></td>
                  </tr>

  7. #7
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,845
    Plugin Contributions
    25

    Default Re: coupon_admin.php: strip_tags() expects at most 2 parameters, 4 given

    Quote Originally Posted by lat9 View Post
    Nope, when I look at the file from the v1.5.1 distribution that I downloaded on 9/18/2012, the offending lines read:
    Code:
              <tr>
                    <td valign="top" class="main"><?php echo TEXT_MESSAGE; ?>&nbsp;&nbsp;</td>
                    <td><?php echo zen_draw_textarea_field('message', 'soft', '60', '15', htmlspecialchars(strip_tags(($_POST['message_html']=='') ? TEXT_COUPON_ANNOUNCE : stripslashes($_POST['message_html']), ENT_COMPAT, CHARSET, TRUE))); ?></td>
                  </tr>
    I must disagree, I even downloaded a fresh zip, but the file does contain the second closing bracket.
    Did you check the date of the file? does it say 9/18/2012 ?

  8. #8
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,845
    Plugin Contributions
    25

    Default Re: coupon_admin.php: strip_tags() expects at most 2 parameters, 4 given

    You are right, it is not present in the github repository, but is is in the distribution zip of 151

  9. #9
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: coupon_admin.php: strip_tags() expects at most 2 parameters, 4 given

    .

    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.

  10. #10
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,871
    Plugin Contributions
    96

    Default Re: coupon_admin.php: strip_tags() expects at most 2 parameters, 4 given

    I don't get it. The file that's in the distribution zip file (zen-cart-v1.5.1-full-fileset-09182012.zip) that I downloaded back in 2012 shows
    Code:
    /**
     * @package admin
     * @copyright Copyright 2003-2012 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version GIT: $Id: Author: Ian Wilson  Tue Aug 7 15:17:58 2012 +0100 Modified in v1.5.1 $
     */
    and contains the uncorrected version.
    Code:
                  <tr>
                    <td valign="top" class="main"><?php echo TEXT_MESSAGE; ?>&nbsp;&nbsp;</td>
                    <td><?php echo zen_draw_textarea_field('message', 'soft', '60', '15', htmlspecialchars(strip_tags(($_POST['message_html']=='') ? TEXT_COUPON_ANNOUNCE : stripslashes($_POST['message_html']), ENT_COMPAT, CHARSET, TRUE))); ?></td>
                  </tr>
    but, as you indicated, a freshly-downloaded v151 distribution shows the same license/header, but with the code corrected.

    I suppose that I, like the code, stand corrected.

 

 

Similar Threads

  1. Replies: 2
    Last Post: 20 Jan 2014, 07:21 PM
  2. 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
  3. v139h PHP Warning: strip_tags() expects parameter 1 to be string, array given
    By BlessIsaacola in forum General Questions
    Replies: 1
    Last Post: 6 Mar 2012, 01:32 PM
  4. PHP Warning: str_repeat() expects exactly 2 parameters,
    By lala rock in forum General Questions
    Replies: 4
    Last Post: 28 Feb 2012, 02:44 AM
  5. htmlspecialchars() expects at most 3 parameters, 4 given
    By jewelsexports in forum General Questions
    Replies: 2
    Last Post: 10 Mar 2011, 04:00 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