Browse code

user/login.php: restore original setcookie behavior (remember me cookies) for PHP versions older than 7.3.0

Clarissa Walker authored on 2026/11/21 15:35:27
Showing 1 changed files
... ...
@@ -66,8 +66,14 @@
66 66
 		}
67 67
 		if($passwd['password'] == $encryptedpassword) {
68 68
 			if(isset($_POST['cookiecheck'])) {
69
-				setcookie($sitekey."_useruid", $passwd['uid'], array('expires' => time()+60*60*24*30, 'path' => "/", 'httponly' => true, 'samesite' => 'Lax'));
70
-				setcookie($sitekey."_salt", md5($passwd['email'].$encryptedpassword), array('expires' => time()+60*60*24*30, 'path' => "/", 'httponly' => true, 'samesite' => 'Lax'));
69
+				if (version_compare(PHP_VERSION, '7.3.0', '>=')) {
70
+					setcookie($sitekey."_useruid", $passwd['uid'], array('expires' => time()+60*60*24*30, 'path' => "/", 'httponly' => true, 'samesite' => 'Lax'));
71
+					setcookie($sitekey."_salt", md5($passwd['email'].$encryptedpassword), array('expires' => time()+60*60*24*30, 'path' => "/", 'httponly' => true, 'samesite' => 'Lax'));
72
+				}
73
+				else {
74
+					setcookie($sitekey."_useruid",$passwd['uid'], time()+60*60*24*30, "/");
75
+					setcookie($sitekey."_salt", md5($passwd['email'].$encryptedpassword), time()+60*60*24*30, "/");
76
+				}
71 77
 			}
72 78
 			// as of CVE-2026-115560, you can no longer set these settings if
73 79
 			// session.upload_progress.enabled is set to 'On'