Skip to content
Permalink
Browse files

BUG Prioritise SS_BASE_URL over flakey SCRIPT_FILENAME check

  • Loading branch information
Damian Mooyman
Damian Mooyman committed Aug 24, 2017
1 parent 47fced8 commit 80cf096a6eb07d620c86eedc76906da7fbd496df
Showing with 7 additions and 7 deletions.
  1. +7 −7 src/includes/constants.php
@@ -75,6 +75,13 @@
if (!defined('BASE_URL')) {
define('BASE_URL', call_user_func(function () {
// Prefer explicitly provided SS_BASE_URL
$base = getenv('SS_BASE_URL');
if ($base) {
// Strip relative path from SS_BASE_URL
return rtrim(parse_url($base, PHP_URL_PATH), '/');
}
// Determine the base URL by comparing SCRIPT_NAME to SCRIPT_FILENAME and getting common elements
// This tends not to work on CLI
$path = realpath($_SERVER['SCRIPT_FILENAME']);
@@ -87,13 +94,6 @@
}
}
// Fall back to SS_BASE_URL
$base = getenv('SS_BASE_URL');
if ($base) {
// Strip relative path from SS_BASE_URL
return rtrim(parse_url($base, PHP_URL_PATH), '/');
}
// Assume no base_url
return '';
}));

0 comments on commit 80cf096

Please sign in to comment.
You can’t perform that action at this time.