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

From: Date: Wed, 17 Apr 2019 15:50:42 +0000
Subject: Doc #74381 [Opn->Csd]: 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-16600@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: girgias@php.net Reported by: rjhdby@php.net Summary: mcrypt_enc_self_test() returns int not bool; returns 0=good, non-zero=bad -Status: Open +Status: Closed Type: Documentation Problem Package: mcrypt related Operating System: - PHP Version: Irrelevant -Assigned To: +Assigned To: girgias Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2019-04-17 15:50:02] girgias@php.net Automatic comment from SVN on behalf of girgias Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=347273 Log: Fix incorrect return values. Fixes Doc Bug #74381 ------------------------------------------------------------------------ [2017-04-06 11:18:59] requinix@php.net 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 ------------------------------------------------------------------------ [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 (#16600) next »