Current location: Hot Scripts Forums » Programming Languages » PHP » Warning: Wrong parameter count...


Warning: Wrong parameter count...

Reply
  #1 (permalink)  
Old 01-22-06, 05:28 PM
Tim Mousel Tim Mousel is offline
Wannabe Coder
 
Join Date: Jan 2005
Posts: 157
Thanks: 0
Thanked 0 Times in 0 Posts
Question Warning: Wrong parameter count...

Hi,

Below is the error I get (using PHP Version 4.4.1):

PHP Code:

WarningWrong parameter count for trim() in /home/public_html/review/functions.php on line 19


Warning
Wrong parameter count for nl2br() in /home/public_html/review/functions.php on line 20

Warning
htmlentities() expects at least 1 parameter0 given in /home/public_html/review/functions.php on line 21 
Here are lines 19-21:

PHP Code:

function clean($v) { 

  
$v stripslashes(trim($v)); 
  
$v nl2br($v); 
  
$v htmlentities($v); 
  return 
$v

Here is the code calling the function:

PHP Code:

$username clean($_POST['username']); 


Any ideas on why I'm getting the errors and how to fix them?

Thanks.

Last edited by Tim Mousel; 01-22-06 at 05:29 PM. Reason: add php version
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 01-22-06, 07:17 PM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
Best guess is that it does not think it is being passed a string. Try echoing the $_POST... and/or assign this to a variable that is then used in the function call.

Short of creating a form to populate the post, I tried this on a php5 system with various values and got expected results for non-existent variables, nulls, strings, and numbers and could not duplicate your errors.

Last edited by mab; 01-22-06 at 07:25 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 01-22-06, 07:39 PM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
I searched for PHP and the error message and turned up some possibilities - a bug in an older version of PHP and the possibility that you are passing an array of values instead of just one value to the function (though when I tried this with a variable that was declared as an array, there was a specific error message that did not match your error.)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 01-22-06, 10:45 PM
Tim Mousel Tim Mousel is offline
Wannabe Coder
 
Join Date: Jan 2005
Posts: 157
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks mab. I'll look at the post variables but I'm pretty sure they are all being passed. The same exact code works for me on my server and others, but when I put it on a certain server, I get those errors.

I'll check out the post variables when I get back to my computer.

Thank you for taking the time to look at this!

Tim
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 01-23-06, 07:33 AM
Oras Oras is offline
Newbie Coder
 
Join Date: Jan 2006
Location: Baghdad, Iraq
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Try the function with static string and check the results.
b.t.w. what is the PHP version in your server?
__________________
e-Haw!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 01-23-06, 01:10 PM
Tim Mousel Tim Mousel is offline
Wannabe Coder
 
Join Date: Jan 2005
Posts: 157
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for your replies.

I changed my function to this and now it works:

PHP Code:

function clean($v) { 

  
$v stripslashes(trim("$v")); 
  
$v nl2br("$v"); 
  
$v htmlentities("$v"); 
  return 
$v

Why would my original function work on some servers but not others?

Thanks,

Tim
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
what am i doing wrong? mixx PHP 3 01-02-06 07:47 PM
Warning: session_start(): Cannot send session cache limiter jozin PHP 4 07-13-05 12:47 AM
Count Searches? fraggle PHP 7 09-19-04 02:59 PM
Wrong parameter count for mysql_fetch_assoc() altlprsn PHP 1 05-26-04 10:40 PM
Post count, why? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 7 10-06-03 04:29 PM


All times are GMT -5. The time now is 07:01 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.