Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Wrong parameter count error message

Posted on 2002-07-08
6
Medium Priority
?
284 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 800 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

618 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