Bug->Doc #74381 [Opn]: mcrypt_enc_self_test() returns int not bool; returns 0=good, non-zero=bad

From: Date: Thu, 06 Apr 2017 11:19:04 +0000
Subject: Bug->Doc #74381 [Opn]: mcrypt_enc_self_test() returns int not bool; returns 0=good, non-zero=bad
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-14591@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74381&edit=1 ID: 74381 Updated by: requinix@php.net Reported by: rjhdby@php.net -Summary: Possible bug +Summary: mcrypt_enc_self_test() returns int not bool; returns 0=good, non-zero=bad Status: Open -Type: Bug +Type: Documentation Problem -Package: Documentation problem +Package: mcrypt related Operating System: - PHP Version: Irrelevant Block user comment: N Private report: N New Comment: What's weird is there was a commit to change it to return bool [1] but it got reverted later that day [2]. It definitely returns int [3]. I didn't find the algorithm code on SF (/modules/algorithms is empty?) but from the tarball I see that rc2.c (as a sample) follows the C convention of returning 0 for success and <0 for failure. We probably shouldn't touch the mcrypt code but fixing the docs should be okay... [1] https://github.com/php/php-src/commit/472b883cc6834f3791fe037f69ec87c635d44d0c [2] https://github.com/php/php-src/commit/fbc29e2848fd71f6ab362c644eefccbe48a8a06f [3] http://mcrypt.cvs.sourceforge.net/viewvc/mcrypt/libmcrypt/lib/mcrypt_modules.c?revision=1.1.1.1&view=markup#l608 Previous Comments: ------------------------------------------------------------------------ [2017-04-06 10:48:21] peehaa@php.net I also like how the signature says int and the return values section says bool. ------------------------------------------------------------------------ [2017-04-06 10:44:04] rjhdby@php.net Description: ------------ --- From manual page: http://www.php.net/function.mcrypt-enc-self-test --- mcrypt_enc_self_test The function returns TRUE if the self test succeeds, or FALSE when it fails. !!!BUT!!! mcrypt_enc_self_test If the self test succeeds it returns FALSE. In case of an error, it returns TRUE. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74381&edit=1

« previous php.doc.bugs (#14591) next »