Link to home
Start Free TrialLog in
Avatar of William Fulks
William FulksFlag for United States of America

asked on

Wrong parameter count error message

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);
}
?>
ASKER CERTIFIED SOLUTION
Avatar of Hamlet081299
Hamlet081299

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of William Fulks

ASKER

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.
Avatar of dkjariwala
dkjariwala

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
So I need to talk with my host and see if they upgraded libmcript to a higher version?  If so, can it be downgraded?
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
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!