EBernhardson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/177403

Change subject: Use the request object provided in User::setCookies
......................................................................

Use the request object provided in User::setCookies

When calling User::setCookies with a $request object that was not
passed on to the User::setCookie method, which went ahead and
updated the request from RequestContext::getMain rather than
the provided request.

This patch adds another parameter to User::setCookie to accept
a request object, and User::setCookies to pass the request along.

Change-Id: Ie46fd8c90753e8bf54ce58842c08e0519a269582
---
M includes/User.php
1 file changed, 8 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/03/177403/1

diff --git a/includes/User.php b/includes/User.php
index c4a6127..084befe 100644
--- a/includes/User.php
+++ b/includes/User.php
@@ -3362,10 +3362,15 @@
         *  false: Force NOT setting the secure attribute when setting the 
cookie
         *  null (default): Use the default ($wgCookieSecure) to set the secure 
attribute
         * @param array $params Array of options sent passed to 
WebResponse::setcookie()
+        * @param WebRequest|null $request WebRequest object to use; $wgRequest 
will be used if null
+        *        is passed.
         */
-       protected function setCookie( $name, $value, $exp = 0, $secure = null, 
$params = array() ) {
+       protected function setCookie( $name, $value, $exp = 0, $secure = null, 
$params = array(), $request = null ) {
+               if ( $request === null ) {
+                       $request = $this->getRequest();
+               }
                $params['secure'] = $secure;
-               $this->getRequest()->response()->setcookie( $name, $value, 
$exp, $params );
+               $request->response()->setcookie( $name, $value, $exp, $params );
        }
 
        /**
@@ -3430,7 +3435,7 @@
                        if ( $value === false ) {
                                $this->clearCookie( $name );
                        } else {
-                               $this->setCookie( $name, $value, 0, $secure );
+                               $this->setCookie( $name, $value, 0, $secure, 
array(), $request );
                        }
                }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/177403
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie46fd8c90753e8bf54ce58842c08e0519a269582
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to