diff --git a/lib/SimpleSAML/Utils/HTTP.php b/lib/SimpleSAML/Utils/HTTP.php index d43c45a5f174cb7d49865a803ad858337e217bc9..402901b67f67f9459cfbbe83ea6a72dc60f59cc6 100644 --- a/lib/SimpleSAML/Utils/HTTP.php +++ b/lib/SimpleSAML/Utils/HTTP.php @@ -675,23 +675,6 @@ class HTTP } - /** - * Retrieve the first element of the URL path. - * - * @param boolean $leadingSlash Whether to add a leading slash to the element or not. Defaults to true. - * - * @return string The first element of the URL path, with an optional, leading slash. - * - */ - public function getFirstPathElement(bool $leadingSlash = true): string - { - if (preg_match('|^/(.*?)/|', $_SERVER['SCRIPT_NAME'], $matches)) { - return ($leadingSlash ? '/' : '') . $matches[1]; - } - return ''; - } - - /** * Create a link which will POST data. * diff --git a/modules/admin/lib/Controller/Config.php b/modules/admin/lib/Controller/Config.php index 42d0b580ee9d78ed56a8c3b144ed642ed2fda9f8..4d582c19b0044f998b1a970e831b59c8cbdcd1ec 100644 --- a/modules/admin/lib/Controller/Config.php +++ b/modules/admin/lib/Controller/Config.php @@ -96,7 +96,6 @@ class Config 'getSelfURLHost()' => [$this->httpUtils->getSelfURLHost()], 'getSelfURLNoQuery()' => [$this->httpUtils->getSelfURLNoQuery()], 'getSelfHostWithPath()' => [$this->httpUtils->getSelfHostWithPath()], - 'getFirstPathElement()' => [$this->httpUtils->getFirstPathElement()], 'getSelfURL()' => [$this->httpUtils->getSelfURL()], ], ]; diff --git a/tests/lib/SimpleSAML/Utils/HTTPTest.php b/tests/lib/SimpleSAML/Utils/HTTPTest.php index 907b0179c654dd571ac17e966dd8bcff7c7c9b8a..855cc91bb39fd2dfc276f3872f89e3435c3c98be 100644 --- a/tests/lib/SimpleSAML/Utils/HTTPTest.php +++ b/tests/lib/SimpleSAML/Utils/HTTPTest.php @@ -443,20 +443,6 @@ class HTTPTest extends ClearStateTestCase } - /** - */ - public function testGetFirstPathElement(): void - { - $original = $_SERVER; - $httpUtils = new Utils\HTTP(); - - $_SERVER['SCRIPT_NAME'] = '/test/tmp.php'; - $this->assertEquals($httpUtils->getFirstPathElement(), '/test'); - $this->assertEquals($httpUtils->getFirstPathElement(false), 'test'); - $_SERVER = $original; - } - - /** * @runInSeparateProcess * @requires extension xdebug