r85112 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85111‎ | r85112 | r85113 >
Date:09:50, 1 April 2011
Author:ialex
Status:ok
Tags:
Comment:
Drop 5.1 compatibility calls to session_set_cookie_params() and setcookie() since we require 5.2.3+ now
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/WebResponse.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -2787,7 +2787,7 @@
27882788 # hasn't already been set to the desired value (that causes errors)
27892789 ini_set( 'session.save_handler', $wgSessionHandler );
27902790 }
2791 - $httpOnlySafe = wfHttpOnlySafe();
 2791+ $httpOnlySafe = wfHttpOnlySafe() && $wgCookieHttpOnly;
27922792 wfDebugLog( 'cookie',
27932793 'session_set_cookie_params: "' . implode( '", "',
27942794 array(
@@ -2795,13 +2795,8 @@
27962796 $wgCookiePath,
27972797 $wgCookieDomain,
27982798 $wgCookieSecure,
2799 - $httpOnlySafe && $wgCookieHttpOnly ) ) . '"' );
2800 - if( $httpOnlySafe && $wgCookieHttpOnly ) {
2801 - session_set_cookie_params( 0, $wgCookiePath, $wgCookieDomain, $wgCookieSecure, $wgCookieHttpOnly );
2802 - } else {
2803 - // PHP 5.1 throws warnings if you pass the HttpOnly parameter for 5.2.
2804 - session_set_cookie_params( 0, $wgCookiePath, $wgCookieDomain, $wgCookieSecure );
2805 - }
 2799+ $httpOnlySafe ) ) . '"' );
 2800+ session_set_cookie_params( 0, $wgCookiePath, $wgCookieDomain, $wgCookieSecure, $httpOnlySafe );
28062801 session_cache_limiter( 'private, must-revalidate' );
28072802 if ( $sessionId ) {
28082803 session_id( $sessionId );
Index: trunk/phase3/includes/WebResponse.php
@@ -33,7 +33,7 @@
3434 if ( $expire == 0 ) {
3535 $expire = time() + $wgCookieExpiration;
3636 }
37 - $httpOnlySafe = wfHttpOnlySafe();
 37+ $httpOnlySafe = wfHttpOnlySafe() && $wgCookieHttpOnly;
3838 wfDebugLog( 'cookie',
3939 'setcookie: "' . implode( '", "',
4040 array(
@@ -43,25 +43,14 @@
4444 $wgCookiePath,
4545 $wgCookieDomain,
4646 $wgCookieSecure,
47 - $httpOnlySafe && $wgCookieHttpOnly ) ) . '"' );
48 - if( $httpOnlySafe && isset( $wgCookieHttpOnly ) ) {
49 - setcookie( $wgCookiePrefix . $name,
50 - $value,
51 - $expire,
52 - $wgCookiePath,
53 - $wgCookieDomain,
54 - $wgCookieSecure,
55 - $wgCookieHttpOnly );
56 - } else {
57 - // setcookie() fails on PHP 5.1 if you give it future-compat paramters.
58 - // stab stab!
59 - setcookie( $wgCookiePrefix . $name,
60 - $value,
61 - $expire,
62 - $wgCookiePath,
63 - $wgCookieDomain,
64 - $wgCookieSecure );
65 - }
 47+ $httpOnlySafe ) ) . '"' );
 48+ setcookie( $wgCookiePrefix . $name,
 49+ $value,
 50+ $expire,
 51+ $wgCookiePath,
 52+ $wgCookieDomain,
 53+ $wgCookieSecure,
 54+ $httpOnlySafe );
6655 }
6756 }
6857
@@ -91,4 +80,4 @@
9281 return $this->cookies[$name];
9382 }
9483 }
95 -}
\ No newline at end of file
 84+}

Status & tagging log