Flip order of conditionals and add explanatory note
authorOri Livneh <ori@wikimedia.org>
Mon, 25 Feb 2013 08:15:40 +0000 (00:15 -0800)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 25 Feb 2013 22:02:14 +0000 (22:02 +0000)
The conditional is nominally more performant and considerably more readable
with its constituents flipped. Also adds an explanatory note. Prompted by
confusion over change Ie89507f8e98c365df9d93a7633223103b9025790.

Change-Id: I2d3db63bdbcebe0fd59c063c9f371362c9d07f91

includes/WebResponse.php

index 3862354..4276fb0 100644 (file)
@@ -70,7 +70,11 @@ class WebResponse {
                        $secureCookie = $forceSecure;
                }
 
-               $httpOnlySafe = wfHttpOnlySafe() && $wgCookieHttpOnly;
+               // Mark the cookie as httpOnly if $wgCookieHttpOnly is true,
+               // unless the requesting user-agent is known to have trouble with
+               // httpOnly cookies.
+               $httpOnlySafe = $wgCookieHttpOnly && wfHttpOnlySafe();
+
                wfDebugLog( 'cookie',
                        'setcookie: "' . implode( '", "',
                                array(