Permalink
Browse files

Merge pull request #17 from lubobill1990/patch-1

When test_domain contains port, setcookie will fail
  • Loading branch information...
2 parents 673d79f + 4fb84a9 commit 9405a358106d62c82879cff99c56108fe792948c @briancray committed Oct 9, 2015
Showing with 2 additions and 1 deletion.
  1. +2 −1 phpab.php
View
@@ -127,7 +127,8 @@ private function setup_ga ()
private function record_user_segment ()
{
- setcookie($this->tag . '-' . $this->test_name, $this->current_variation, time() + (60 * 60 * 24 * 365), '/', $this->test_domain);
+ $cookie_domain = (($colon_position = strrpos($this->test_domain, ":")) === false) ? $this->test_domain : substr($this->test_domain, 0, $colon_position);
+ setcookie($this->tag . '-' . $this->test_name, $this->current_variation, time() + (60 * 60 * 24 * 365), '/', $cookie_domain);
}
public function set_domain ($d)

0 comments on commit 9405a35

Please sign in to comment.