improved check quality

!empty verifies that $username has been set with a significant value of any kind; is_string makes sure the type is really what is being expected in the following code.
This commit is contained in:
Thomas Heidrich 2017-02-09 23:39:06 +01:00 committed by GitHub
parent e28bbf04d2
commit 3a7e04c69c

View File

@ -530,7 +530,7 @@ function serendipity_authenticate_author($username = '', $password = '', $is_has
} }
if ($debug) fwrite($fp, date('Y-m-d H:i') . ' - Login username check:' . $username . "\n"); if ($debug) fwrite($fp, date('Y-m-d H:i') . ' - Login username check:' . $username . "\n");
if ($username != '' && is_string($username)) { if (!empty($username) && is_string($username)) {
if ($use_external) { if ($use_external) {
serendipity_plugin_api::hook_event('backend_auth', $is_hashed, array('username' => $username, 'password' => $password)); serendipity_plugin_api::hook_event('backend_auth', $is_hashed, array('username' => $username, 'password' => $password));
} }
@ -2235,4 +2235,4 @@ function serendipity_passwordhash($cleartext_password) {
} }
} }
/* vim: set sts=4 ts=4 expandtab : */ /* vim: set sts=4 ts=4 expandtab : */