* path: string, cookie path ($wgCookiePath)
* secure: bool, secure attribute ($wgCookieSecure)
* httpOnly: bool, httpOnly attribute ($wgCookieHttpOnly)
- * raw: bool, if true uses PHP's setrawcookie() instead of setcookie()
- * For backwards compatibility, if $options is not an array then it and
- * the following two parameters will be interpreted as values for
- * 'prefix', 'domain', and 'secure'
* @since 1.22 Replaced $prefix, $domain, and $forceSecure with $options
*/
public function setCookie( $name, $value, $expire = 0, $options = [] ) {
global $wgCookiePath, $wgCookiePrefix, $wgCookieDomain;
global $wgCookieSecure, $wgCookieExpiration, $wgCookieHttpOnly;
- if ( !is_array( $options ) ) {
- // Backwards compatibility
- $options = [ 'prefix' => $options ];
- if ( func_num_args() >= 5 ) {
- $options['domain'] = func_get_arg( 4 );
- }
- if ( func_num_args() >= 6 ) {
- $options['secure'] = func_get_arg( 5 );
- }
- }
$options = array_filter( $options, function ( $a ) {
return $a !== null;
} ) + [
global $wgCookiePath, $wgCookiePrefix, $wgCookieDomain;
global $wgCookieSecure, $wgCookieExpiration, $wgCookieHttpOnly;
- if ( !is_array( $options ) ) {
- // Backwards compatibility
- $options = [ 'prefix' => $options ];
- if ( func_num_args() >= 5 ) {
- $options['domain'] = func_get_arg( 4 );
- }
- if ( func_num_args() >= 6 ) {
- $options['secure'] = func_get_arg( 5 );
- }
- }
$options = array_filter( $options, function ( $a ) {
return $a !== null;
} ) + [