Sometimes SCRIPT_URL isn't available. 2016-04-07
authorIain Patterson <me@iain.cx>
Thu, 7 Apr 2016 15:47:21 +0000 (11:47 -0400)
committerIain Patterson <me@iain.cx>
Thu, 7 Apr 2016 15:47:21 +0000 (11:47 -0400)
If not running in a virtualhost context, Apache may expose REDIRECT_URL
instead.

www/index.php

index e181d08..f8434a9 100644 (file)
@@ -13,7 +13,8 @@
   Propel::init("$propel_root/build/conf/$propel_project-conf.php");
   set_include_path(join(PATH_SEPARATOR, array(join(DIRECTORY_SEPARATOR, array($propel_root, "build", "classes")), get_include_path())));
 
-  $request = preg_replace('!^/branches/[^/]+/!', "", $_SERVER['SCRIPT_URL']);
+  $script_url = array_key_exists('SCRIPT_URL', $_SERVER) ? $_SERVER['SCRIPT_URL'] : $_SERVER['REDIRECT_URL'];
+  $request = preg_replace('!^/branches/[^/]+/!', "", $script_url);
   $request = preg_replace('!^/+!', "", $request);
   $request = preg_replace('!/+$!', "", $request);