php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #48371 Documentation for: mcrypt_get_key_size()
Submitted: 2009-05-24 02:48 UTC Modified: 2009-11-19 10:04 UTC
From: alias301 at gmail dot com Assigned: kalle (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: N/A
Private report: No CVE-ID: None
 [2009-05-24 02:48 UTC] alias301 at gmail dot com
Description:
------------
The documentation for mcrypt_get_key_size() says that it wants the $module as the second parameter, but should be $mode
Also, were it says "Example #1 mcrypt_get_block_size() example" it should be "Example #1 mcrypt_get_key_size() example"

See: http://us3.php.net/function.mcrypt_get_key_size


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-25 18:21 UTC] kalle@php.net
Its $module as per its source, see php-src/ext/mcrypt/mcrypt.c, in the PHP_FUNCTION(mcrypt_get_key_size) block.

The link have been fixed in CVS.
 [2009-05-28 01:46 UTC] alias301 at gmail dot com
The prototype says:
int mcrypt_get_key_size  ( string $cipher  , string $module  )
where $module = 'ecb';

however the prototype:
resource mcrypt_module_open  ( string $algorithm  , string $algorithm_directory  , string $mode  , string $mode_directory  )

says $mode = 'ofb';  // which could also be 'ecb'


which means that the documentation is not connsistent shich can lead to others believing (like me at first) that $module was the module resource that had been opened with mcrypt_module_open() and part of documentation is being conssistent, so I believe that it should be a prototype of: int mcrypt_get_key_size  ( string $cipher  , string $mode  ) so as to convey the correct message to those who will use this documentation.

Also, to add to this I have checked with the source for the mcrypt extension as in the code is shows this call:
td = mcrypt_module_open(cipher, cipher_dir_string, module, module_dir_string);
So, I guess my question is why is it that the extension uses module when clearly the documentation shows mode.

This clearly need to be fixed so that the function calls have matching documentation.

----
Also, this clearly shows that in the C source that mcrypt_module_open() does use that variable as mode *not* module
if (zend_parse_parameters (ZEND_NUM_ARGS() TSRMLS_CC, "ssss",
		&cipher, &cipher_len, &cipher_dir, &cipher_dir_len,
		&mode,   &mode_len,   &mode_dir,   &mode_dir_len)) {
		return;
	}


Thank You
 [2009-06-23 15:51 UTC] kalle@php.net
Thanks for your detailed comment, I didn't see it before now because I was set as assigned but Ill look into it ;)
 [2009-11-19 10:04 UTC] vrana@php.net
Fixed by kalle.
 [2020-02-07 06:10 UTC] phpdocbot@php.net
Automatic comment on behalf of kalle
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=7c30dbad6d4047c87438ad6895b9dba8f141fb9c
Log: Fixed bug #48371 (Documentation for: mcrypt_get_key_size())
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Jun 17 02:00:02 2026 UTC