[2/2] fix more php 7.4 warnings

Message ID 20200212201638.3051647-3-eschwartz@archlinux.org
State New
Headers show
Series
  • php warning fixes
Related show

Commit Message

Eli Schwartz Feb. 12, 2020, 8:16 p.m. UTC
The try_login() function documents it returns an array containing an
'error' key, and our only caller *only* consults the 'error' key. Then
the function returns null instead of an array, if the login succeeded!

I question why we bother returning the new SID if we never use it,
surely we could either return the error or return default null. But, for
now, I'm just going to fix it to return what it's actually supposed to,
without changing the API.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
---
 web/lib/acctfuncs.inc.php | 1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php
index 443fb4b1..d238c0e0 100644
--- a/web/lib/acctfuncs.inc.php
+++ b/web/lib/acctfuncs.inc.php
@@ -659,6 +659,7 @@  function try_login() {
 	}
 	header("Location: " . get_uri($referer));
 	$login_error = "";
+	return array('SID' => $new_sid, 'error' => null);
 }
 
 /**