| 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 | ||
[24 May 2:48am UTC] alias301 at gmail dot com
[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.
