diff --git a/lib/SimpleSAML/Configuration.php b/lib/SimpleSAML/Configuration.php index d56768a2a4613f5308e106534cec8fa8a0fa20dd..14d09dec789744268c7d9c86634676e4994c3b6d 100644 --- a/lib/SimpleSAML/Configuration.php +++ b/lib/SimpleSAML/Configuration.php @@ -416,10 +416,8 @@ class SimpleSAML_Configuration $path = $this->getBaseDir().$path; } - /* Remove trailing slashes. */ - while (substr($path, -1) === '/') { - $path = substr($path, 0, -1); - } + // remove trailing slashes + $path = rtrim($path, '/'); return $path; } diff --git a/lib/SimpleSAML/Utils/System.php b/lib/SimpleSAML/Utils/System.php index 8889251a9e1c48ec0824371950a5743e4b15a2b2..6a9ec0e85723c7900514c3b0e755b3fe3945edd6 100644 --- a/lib/SimpleSAML/Utils/System.php +++ b/lib/SimpleSAML/Utils/System.php @@ -114,10 +114,8 @@ class System $base = $config->getBaseDir(); } - // remove trailing slashes from $base - while (substr($base, -1) === '/') { - $base = substr($base, 0, -1); - } + // remove trailing slashes + $base = rtrim($base, '/'); // check for absolute path if (substr($path, 0, 1) === '/') {