PHP Bugs  
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #48371 Documentation for: mcrypt_get_key_size()
Submitted:24 May 2:48am UTC Modified: 19 Nov 10:04am UTC
From:alias301 at gmail dot com Assigned to:kalle
Status:Closed Category:Documentation problem
Version:Irrelevant OS:N/A
View/Vote Developer Edit Submission

[24 May 2:48am 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

[25 May 6:21pm 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.
[28 May 1:46am 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
[23 Jun 3:51pm 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 ;)
[19 Nov 10:04am UTC] vrana@php.net
Fixed by kalle.

RSS feed | show source 

PHP Copyright © 2001-2009 The PHP Group
All rights reserved.
Last updated: Sat Nov 21 10:30:49 2009 UTC