Solved

Wrong parameter count error message

Posted on 2002-07-08
6
251 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
  • 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 13

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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 13

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 13

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
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…
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now