diff --git a/res/phar-stub.php b/res/phar-stub.php index 52bb00b..20e1651 100644 --- a/res/phar-stub.php +++ b/res/phar-stub.php @@ -9,17 +9,14 @@ if (!in_array('phar', stream_get_wrappers()) function mapUrls($path) { - if (substr($path, 0, 5) !== '/www/') { - return false; - } $arMap = array( - '/www/' => '/www/index.php', - '/www/gsearch/' => '/www/gsearch/index.php', + '/' => '/www/index.php', + '/gsearch/' => '/www/gsearch/index.php', ); if (isset($arMap[$path])) { return $arMap[$path]; } - return $path; + return '/www' . $path; } Phar::interceptFileFuncs(); diff --git a/src/SemanticScuttle/Environment.php b/src/SemanticScuttle/Environment.php index 743f79e..bd1020b 100644 --- a/src/SemanticScuttle/Environment.php +++ b/src/SemanticScuttle/Environment.php @@ -74,6 +74,7 @@ class SemanticScuttle_Environment $_SERVER['PATH_TRANSLATED'], strpos($_SERVER['PATH_TRANSLATED'], $rootTmp) + strlen($rootTmp) + + 4 /* strip "www/" */ ); } diff --git a/tests/SemanticScuttle/EnvironmentTest.php b/tests/SemanticScuttle/EnvironmentTest.php index 52761a1..84e3f52 100644 --- a/tests/SemanticScuttle/EnvironmentTest.php +++ b/tests/SemanticScuttle/EnvironmentTest.php @@ -330,7 +330,7 @@ class SemanticScuttle_EnvironmentTest extends PHPUnit_Framework_TestCase 'PHAR_PATH_TRANSLATED' => '/home/cweiske/Dev/html/hosts/dist.bm.bogo/www/index.php', ); $this->assertEquals( - '//dist.bm.bogo/SemanticScuttle-0.98.X.phar/www/', + '//dist.bm.bogo/SemanticScuttle-0.98.X.phar/', SemanticScuttle_Environment::getRoot() ); } @@ -352,7 +352,7 @@ class SemanticScuttle_EnvironmentTest extends PHPUnit_Framework_TestCase 'PHAR_PATH_TRANSLATED' => '/home/cweiske/Dev/html/hosts/dist.bm.bogo/www/index.php/foo/bar/', ); $this->assertEquals( - '//dist.bm.bogo/SemanticScuttle-0.98.X.phar/www/', + '//dist.bm.bogo/SemanticScuttle-0.98.X.phar/', SemanticScuttle_Environment::getRoot() ); }