From: Alexander Ebert Date: Fri, 24 Jan 2014 16:52:57 +0000 (+0100) Subject: Fixed handling of non-standard ports for cookie domain X-Git-Tag: 2.0.2~13^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ee2ecd24a16207b9c8351bcb127a40561efbdd01;p=GitHub%2FWoltLab%2FWCF.git Fixed handling of non-standard ports for cookie domain --- diff --git a/wcfsetup/install/files/lib/acp/form/ApplicationEditForm.class.php b/wcfsetup/install/files/lib/acp/form/ApplicationEditForm.class.php index af64d3fa98..edb78758ec 100644 --- a/wcfsetup/install/files/lib/acp/form/ApplicationEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/ApplicationEditForm.class.php @@ -129,8 +129,12 @@ class ApplicationEditForm extends AbstractForm { throw new UserInputException('cookieDomain', 'containsPath'); } + // strip port from cookie domain + $regex = new Regex(':[0-9]+$'); + $this->cookieDomain = $regex->replace($this->cookieDomain, ''); + // check if cookie domain shares the same domain (may exclude subdomains) - if (!StringUtil::endsWith($this->domainName, $this->cookieDomain)) { + if (!StringUtil::endsWith($regex->replace($this->domainName, ''), $this->cookieDomain)) { throw new UserInputException('cookieDomain', 'notValid'); } } diff --git a/wcfsetup/install/files/lib/data/application/ApplicationAction.class.php b/wcfsetup/install/files/lib/data/application/ApplicationAction.class.php index a6f6ab0ad6..c64f2232c0 100644 --- a/wcfsetup/install/files/lib/data/application/ApplicationAction.class.php +++ b/wcfsetup/install/files/lib/data/application/ApplicationAction.class.php @@ -5,6 +5,7 @@ use wcf\system\cache\builder\ApplicationCacheBuilder; use wcf\system\exception\PermissionDeniedException; use wcf\system\exception\UserInputException; use wcf\system\language\LanguageFactory; +use wcf\system\Regex; use wcf\system\WCF; use wcf\util\FileUtil; use wcf\util\StringUtil; @@ -52,9 +53,10 @@ class ApplicationAction extends AbstractDatabaseObjectAction { // calculate cookie path $domains = array(); + $regex = new Regex(':[0-9]+'); foreach ($this->objects as $application) { $domainName = $application->domainName; - if (StringUtil::endsWith($domainName, $application->cookieDomain)) { + if (StringUtil::endsWith($regex->replace($domainName, ''), $application->cookieDomain)) { $domainName = $application->cookieDomain; }