• I think the way you are constructing the cookies manually doesn’t work for mobile edge. I’ve updated the code as follows but it will only work for PHP 7.3.

    function samesite_setcookie($name, $value, array $options) {
    
    	setcookie($name, $value, $options);
    	$_COOKIE[$name] = $value;
    
    /*
    	$header = 'Set-Cookie:';
    	$header .= rawurlencode($name) . '=' . rawurlencode($value) . ';';
    
    	if (!empty($options['expires']) && $options['expires'] > 0) {
    		$header .= 'expires=' . \gmdate('D, d-M-Y H:i:s T', (int) $options['expires']) . ';';
    		$header .= 'Max-Age=' . max(0, (int) ($options['expires'] - time())) . ';';
    	}
    
    	$header .= 'path=' . rawurlencode($options['path']). ';';
    	$header .= 'domain=' . rawurlencode($options['domain']) . ';';
    
    	if (!empty($options['secure'])) {
    		$header .= 'secure;';
    	}
    	$header .= 'httponly;';
    	$header .= 'SameSite=' . rawurlencode($options['samesite']);
    
    	header($header, false);
    	$_COOKIE[$name] = $value;
    */
    
    }

    I guess your original code can be made to work in older versions. Perhaps you need spaces between the values and the ; delimiter in the SetCookie header but I haven’t investigated further.

    • This topic was modified 3 years, 4 months ago by ssandison.
  • The topic ‘Issue with setting login cookies in mobile edge’ is closed to new replies.