Zen Cart Logo
Forums / Bug Reports / [Duplicate] coupon_admin.php: strip_tags() expects at most 2 parameters, 4 given

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

Views: 2,487

Results 1 to 10 of 10
20 Jan 2014, 5:57 PM
#1
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,102
Plugin Contributions:
56

[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:

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

              <tr>
                <td valign="top" class="main"><?php echo TEXT_MESSAGE; ?>  </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

              <tr>
                <td valign="top" class="main"><?php echo TEXT_MESSAGE; ?>  </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>
20 Jan 2014, 6:10 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

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

20 Jan 2014, 6:27 PM
#3
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,102
Plugin Contributions:
56

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

DrByte:

Fixed in v1.5.1:
http://www.zen-cart.com/showthread.php?200257
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).

20 Jan 2014, 6:30 PM
#4
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

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

lat9:

Running Zen Cart v1.5.1 on PHP 5.38. I noticed that I had the following debug-log:

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
> ```
              <tr>
                <td valign="top" class="main"><?php echo TEXT_MESSAGE; ?>  </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

          <tr>
            <td valign="top" class="main"><?php echo TEXT_MESSAGE; ?>  </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?
20 Jan 2014, 6:36 PM
#5
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,102
Plugin Contributions:
56

Re: [Duplicate] 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:

          <tr>
                <td valign="top" class="main"><?php echo TEXT_MESSAGE; ?>  </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>
20 Jan 2014, 6:49 PM
#6
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,102
Plugin Contributions:
56

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

lat9:

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.

20 Jan 2014, 6:50 PM
#7
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

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

lat9:

Nope, when I look at the file from the v1.5.1 distribution that I downloaded on 9/18/2012, the offending lines read:

      <tr>
            <td valign="top" class="main"><?php echo TEXT_MESSAGE; ?>  </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 ?
20 Jan 2014, 6:53 PM
#8
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: [Duplicate] 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

20 Jan 2014, 8:21 PM
#10
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,102
Plugin Contributions:
56

Re: [Duplicate] 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

/**
 * @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.

              <tr>
                <td valign="top" class="main"><?php echo TEXT_MESSAGE; ?>  </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.