From 4d4966ddd79a017b8bc7d714b6944f8c1ccbf301 Mon Sep 17 00:00:00 2001
From: Jaime Perez Crespo <jaime.perez@uninett.no>
Date: Fri, 31 Jul 2015 15:10:42 +0200
Subject: [PATCH] Use the predefined rtrim() function instead of a while loop.

---
 lib/SimpleSAML/Configuration.php | 6 ++----
 lib/SimpleSAML/Utils/System.php  | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/lib/SimpleSAML/Configuration.php b/lib/SimpleSAML/Configuration.php
index d56768a2a..14d09dec7 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 8889251a9..6a9ec0e85 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) === '/') {
-- 
GitLab