Make sure that $this->url is set, try like $num = 0; if(isset($this->url) && $this->url!=null && $this->url!="") $num = strlen(stristr($link,$this->url)); if ($num>0) Code (markup): Them you prevent the error. However you might want the url to be set, so please check that in your code.