note 126439 added to function.openssl-verify

From: Date: Mon, 20 Sep 2021 13:17:31 +0000
Subject: note 126439 added to function.openssl-verify
Groups: php.notes 
Request: Send a blank email to php-notes+get-216977@lists.php.net to get a copy of this message
As stated from the doc: "Returns 1 if the signature is correct, 0 if it is incorrect, and -1 or false on error. " In the second example as a well as in Stiv's note, following condition will match for both 0 or false, which have different meaning: elseif ($ok == 0) { echo "bad"; } On should do an identical test here (===) instead of an equal test (==): elseif ($ok === 0) { echo "bad"; } --- var_dump(0==false); //==> true var_dump(0===false);//==> false ---- Server IP: 45.112.84.4 Probable Submitter: 45.112.85.242 (proxied: 80.15.33.151) ---- Manual Page -- https://php.net/manual/en/function.openssl-verify.php Edit -- https://main.php.net/note/edit/126439 Del: integrated -- https://main.php.net/note/delete/126439/integrated Del: useless -- https://main.php.net/note/delete/126439/useless Del: bad code -- https://main.php.net/note/delete/126439/bad+code Del: spam -- https://main.php.net/note/delete/126439/spam Del: non-english -- https://main.php.net/note/delete/126439/non-english Del: in docs -- https://main.php.net/note/delete/126439/in+docs Del: other reasons-- https://main.php.net/note/delete/126439 Reject -- https://main.php.net/note/reject/126439 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#216977) next »