Skip to content

Commit

Permalink
fixing windows/ms-dos paths causing issues with base_href guessing, r…
Browse files Browse the repository at this point in the history
…elated to #309
  • Loading branch information
henriyli committed Sep 25, 2015
1 parent 3df934c commit 0ca06b3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions controller/WebController.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ private function guessBaseHref()
$script_name = filter_input(INPUT_SERVER, 'SCRIPT_NAME', FILTER_SANITIZE_STRING);
$script_filename = filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING);
$script_filename = realpath($script_filename); // resolve any symlinks (see #274)
$script_filename = str_replace("\\", "/", $script_filename); // fixing windows paths with \ (see #309)
$base_dir = __DIR__; // Absolute path to your installation, ex: /var/www/mywebsite
$base_dir = str_replace("\\", "/", $base_dir); // fixing windows paths with \ (see #309)
$doc_root = preg_replace("!{$script_name}$!", '', $script_filename); # ex: /var/www
$base_url = preg_replace("!^{$doc_root}!", '', $base_dir); # ex: '' or '/mywebsite'
$base_url = str_replace('/controller','/',$base_url);
Expand Down

0 comments on commit 0ca06b3

Please sign in to comment.