/**
  * Set session.cookie_domain
  * 
  * @param  string $cookieDomain 
  * @return StandardConfiguration
  * @throws SessionException
  */
 public function setCookieDomain($cookieDomain)
 {
     if (!is_string($cookieDomain)) {
         throw new SessionException('Invalid cookie domain: must be a string');
     }
     $validator = new HostnameValidator(HostnameValidator::ALLOW_ALL);
     if (!empty($cookieDomain) && !$validator->isValid($cookieDomain)) {
         throw new SessionException('Invalid cookie domain: ' . implode('; ', $validator->getMessages()));
     }
     $this->_cookieDomain = $cookieDomain;
     $this->setStorageOption('cookie_domain', $cookieDomain);
     return $this;
 }
Beispiel #2
0
 /**
  * @see ZF-7277
  */
 public function testDifferentIconvEncoding()
 {
     iconv_set_encoding('internal_encoding', 'ISO8859-1');
     $validator = new Hostname\Hostname();
     $valuesExpected = array(array(true, array('bürger.com', 'hãllo.com', 'hållo.com')), array(true, array('bÜrger.com', 'hÃllo.com', 'hÅllo.com')), array(false, array('hãllo.lt', 'bürger.lt', 'hãllo.lt')));
     foreach ($valuesExpected as $element) {
         foreach ($element[1] as $input) {
             $this->assertEquals($element[0], $validator->isValid($input), implode("\n", $validator->getMessages()) . $input);
         }
     }
 }
Beispiel #3
0
 /**
  * validateHost()
  * 
  * @param $host
  * @return bool
  */
 public static function validateHost($host)
 {
     // If the host is empty, then it is considered invalid
     if (strlen($host) === 0) {
         return false;
     }
     // Check the host against the allowed values; delegated to Zend_Filter.
     $validate = new Hostname\Hostname(Hostname\Hostname::ALLOW_ALL);
     return $validate->isValid($host);
 }