Solved

Wrong parameter count error message

Posted on 2002-07-08
6
268 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 15

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
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 
LVL 15

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 15

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

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