Solved

Wrong parameter count error message

Posted on 2002-07-08
6
265 Views
Last Modified: 2008-03-06
The following code is included in every page on a site I'm updating, and every page is showing the following error at the top:

Warning: Wrong parameter count for mcrypt_get_block_size() in /home/gulfcoastb/html/base.php on line 20

Below is the code for the base.php file that it refers to.  The thing is, this site has worked just fine before.  I don't really know what the Mcrypt_Crypt code is doing.  Any ideas?

<?

$os = "UNIX";

$fnTitle = "GulfCoastBridge.com";
$fnCompany = "Gulf Coast Bridge";
$fnUrl = "http://www.GulfCoastBridge.com/";

$fnBasePath = "http://www.GulfCoastBridge.com/";
$fnImagePath = "http://www.GulfCoastBridge.com/images/";
$fnCSSPath = "/includes/";

$path = "../../db/bridge/";
if ($rootpath == true) $path = substr($path, 3, strlen($path) - 3);

if ($os == "UNIX") $usemcrypt = true;
if ($usemcrypt) {
    $mkey = "mykey";
    $ecrypt = MCRYPT_CRYPT;
    $esize = mcrypt_get_block_size($ecrypt);
}
?>
0
Comment
Question by:William Fulks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 5

Accepted Solution

by:
Hamlet081299 earned 200 total points
ID: 7139824
It seems likely to be a change to the version of mcrypt.

libmcrypt 2.2.x was like this ...

  int mcrypt_get_block_size(int cipher)

and libmcrypt 2.4.x. became ...

  int mcrypt_get_block_size(string cipher, string module)

So you need to change to specify the cipher and module strings, rather than just the ciper id.


0
 
LVL 14

Author Comment

by:William Fulks
ID: 7140169
So then what would I change it to?  And what exactly is this code doing...I see that it is encrypting the information, but I don't know why the person who did this site would want to do that.
0
 
LVL 5

Expert Comment

by:dkjariwala
ID: 7140496
That is the only piece of code being used ?

That code DOESNT Do ANYTHING except setting few variables. Is the file in which this code is present, getting included somewhere ? Then only it will make sense. Otherwise running this code won't produce anything fruitful.


Also, $usemcrypt variable is used without reason. You can just write,

<?

$os = "UNIX";

$fnTitle = "GulfCoastBridge.com";
$fnCompany = "Gulf Coast Bridge";
$fnUrl = "http://www.GulfCoastBridge.com/";

$fnBasePath = "http://www.GulfCoastBridge.com/";
$fnImagePath = "http://www.GulfCoastBridge.com/images/";
$fnCSSPath = "/includes/";

$path = "../../db/bridge/";
if ($rootpath == true) $path = substr($path, 3, strlen($path) - 3);

if ($os == "UNIX") {
   $mkey = "mykey";
   $ecrypt = MCRYPT_CRYPT;
   $esize = mcrypt_get_block_size($ecrypt);
}
?>

Again, provide $usemcrypt is not used anywhere else again.

And I checked php.net site,

It says,

int mcrypt_get_block_size ( int cipher)

int mcrypt_get_block_size ( string cipher, string module)


The first prototype is when linked against libmcrypt 2.2.x, the second when linked against libmcrypt 2.4.x or 2.5.x.

That means your library version is more than 2.4.x. So you have to pass something like

// i wonder what you will store in $module.
//check libmcrypt documentation for that.
$esize = mcrypt_get_block_size($ecrypt,$module);


JD
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Author Comment

by:William Fulks
ID: 7141721
So I need to talk with my host and see if they upgraded libmcript to a higher version?  If so, can it be downgraded?
0
 
LVL 5

Expert Comment

by:dkjariwala
ID: 7143093
They have definitely upgraded, that is what error message shows.

Now whether it can be downgraded or not is something u need to take up with sysadmin.

I guess better idea will be to use new version, just find out in docs, what is the 2nd parameter is all about.
JD
0
 
LVL 14

Author Comment

by:William Fulks
ID: 7153094
The server had been upgraded without notifying anyone, and that is what caused the problem.  They moved me over to another one for the time being.  Thanks!
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question