BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
Cookie Class Reference

Public Member Functions

 __construct ($name, $value, $attr)
 
 set ($value, $attr)
 
 serializeToHttpRequest ($path, $domain)
 

Static Public Member Functions

static validateCookieDomain ($domain, $originDomain=null)
 

Protected Member Functions

 canServeDomain ($domain)
 
 canServePath ($path)
 
 isUnExpired ()
 

Protected Attributes

 $name
 
 $value
 
 $expires
 
 $path
 
 $domain
 
 $isSessionKey = true
 

Member Function Documentation

Cookie::canServeDomain (   $domain)
protected
Parameters
string$domain
Returns
bool
Cookie::canServePath (   $path)
protected
Parameters
string$path
Returns
bool
Cookie::isUnExpired ( )
protected
Returns
bool
Cookie::serializeToHttpRequest (   $path,
  $domain 
)

Serialize the cookie jar into a format useful for HTTP Request headers.

Parameters
string$pathThe path that will be used. Required.
string$domainThe domain that will be used. Required.
Returns
string
Cookie::set (   $value,
  $attr 
)

Sets a cookie. Used before a request to set up any individual cookies. Used internally after a request to parse the Set-Cookie headers.

Parameters
string$valueThe value of the cookie
array$attrPossible key/values: expires A date string path The path this cookie is used on domain Domain this cookie is used on
Exceptions
InvalidArgumentException
static Cookie::validateCookieDomain (   $domain,
  $originDomain = null 
)
static

Return the true if the cookie is valid is valid. Otherwise, false. The uses a method similar to IE cookie security described here: http://kuza55.blogspot.com/2008/02/understanding-cookie-security.html A better method might be to use a blacklist like http://publicsuffix.org/

Todo:

fixme fails to detect 3-letter top-level domains

fixme fails to detect 2-letter top-level domains for single-domain use (probably not a big problem in practice, but there are test cases)

Parameters
string$domainThe domain to validate
string$originDomain(optional) the domain the cookie originates from
Returns
bool

The documentation for this class was generated from the following file: