From 4aff5b2a4829b72ed999588309c83b8c599122f0 Mon Sep 17 00:00:00 2001 From: Greg Sherwood Date: Tue, 9 May 2017 11:56:22 +1000 Subject: [PATCH] Sanity check - handle the case where nothing needs to be cleaned (ref #1451) --- src/Util/Common.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Util/Common.php b/src/Util/Common.php index ec1b1ca7c7..ca8b5b81be 100644 --- a/src/Util/Common.php +++ b/src/Util/Common.php @@ -442,8 +442,14 @@ public static function cleanSniffClass($sniffClass) return $newName; } - $end = (strlen($newName) - $sniffPos + 1); - $start = strrpos($newName, '\\', ($end * -1)); + $end = (strlen($newName) - $sniffPos + 1); + $start = strrpos($newName, '\\', ($end * -1)); + + if ($start === false) { + // Nothing needs to be cleaned. + return $newName; + } + $newName = substr($newName, ($start + 1)); return $newName;