From a4a39ec0ef1063aefae0c7bc15a898a48f0a3bc0 Mon Sep 17 00:00:00 2001 From: Stefan Hayden Date: Tue, 13 Aug 2013 00:05:44 -0400 Subject: [PATCH] Fixing Accidentally Removing all "/" from route $url_path = str_replace(dirname($_SERVER['PHP_SELF']), '', $this->requested_url); if $_SERVER['PHP_SELF'] is "/index.php" the the dirname is "/" if you do a string replace on "http://domain.com/some/route" with a dirname of "/" then the result is "http:domain.comsomeroute" which makes no sense. Simply passing parse_url($this->requested_url, PHP_URL_PATH) should output the correct string of "some/route" --- basecoat/classes/routing.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/basecoat/classes/routing.class.php b/basecoat/classes/routing.class.php index de52ea3..98db2ea 100644 --- a/basecoat/classes/routing.class.php +++ b/basecoat/classes/routing.class.php @@ -232,8 +232,7 @@ public function parseUrl($url=null) { // Check what URL format is in use if ( $this->settings['use_pretty_urls'] ) { // Determine path relative to document root - $url_path = str_replace(dirname($_SERVER['PHP_SELF']), '', $this->requested_url); - $url_path = trim( parse_url($url_path, PHP_URL_PATH), '/'); + $url_path = trim( parse_url($this->requested_url, PHP_URL_PATH), '/'); if ( $url_path=='' ) { $this->run_routes = array('/'); } else { @@ -293,4 +292,4 @@ private function logProfiling($route_name) { ); } -} \ No newline at end of file +}