Another bug in PicoraDispatcher::getUrl()

If the URL includes a port-component like http://myhost:3500/, the redirect cuts of the trailing 0 from the port. He redirects to http://myhost:350/...

If i found the bug, I'll fix it.

Posted August 22nd, 2007 at 11:50am by Aaron

Quick fix (I don't know what substr(self::$status['base_url'],0,-1) is need for ...):


if($route_string && !preg_match('/\:[^\/]/',$route_string))
    return ($include_base_url
        ? /*substr(self::$status['base_url'],0,-1) */ BASE_URL
        : '').$route_string.(is_string($include_base_url) || is_array($include_base_url)
            ? (is_string($include_base_url)
                ? $include_base_url
                : http_build_query($include_base_url,null,'&'))
            : '');
throw new Exception('Could not resolve URL');

Posted August 22nd, 2007 at 12:00pm by Aaron

Argh, forget line-numbers: PicoraDispatcher.php, method getUrl(), line 199 (i hope). Replace the Return-Statement.

After thinking a bit, substr(self::$status['baseurl'],0,-1) should kill the trailing slash from the BASEURL, right? My BASE_URL looks like this:


define('BASE_URL','http://aaron-mueller:2999');

So, here is a workaround to deal with and without trailing slashes:


return ($include_base_url
    ? (substr(self::$status['base_url'], -1) == '/'
        ? substr(self::$status['base_url'],0,-1)
        : self::$status['base_url'])
    : '').$route_string.(is_string($include_base_url) || is_array($include_base_url)
        ? (is_string($include_base_url)
            ? $include_base_url
            : http_build_query($include_base_url,null,'&'))
        : '');

Posted August 22nd, 2007 at 12:12pm by Aaron

Login or Register to Post