From 8dccc2ad07fe866c13a7d0c55ffa04272b4df614 Mon Sep 17 00:00:00 2001 From: "J. Adams" Date: Thu, 18 Feb 2021 21:55:22 -0800 Subject: [PATCH] updated Router to properly translate uri dashes that map to controller subdirectories. fix issue #4294 --- system/Router/Router.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/system/Router/Router.php b/system/Router/Router.php index 1c61d121940d..cdbf46cb38a6 100644 --- a/system/Router/Router.php +++ b/system/Router/Router.php @@ -594,11 +594,13 @@ protected function validateRequest(array $segments): array // is found or when such a directory doesn't exist while ($c-- > 0) { - $test = $this->directory . ucfirst($this->translateURIDashes === true ? str_replace('-', '_', $segments[0]) : $segments[0]); + $segmentConvert = ucfirst($this->translateURIDashes === true ? str_replace('-', '_', $segments[0]) : $segments[0]); + $test = APPPATH . 'Controllers/' . $this->directory . $segmentConvert; - if (! is_file(APPPATH . 'Controllers/' . $test . '.php') && $directoryOverride === false && is_dir(APPPATH . 'Controllers/' . $this->directory . ucfirst($segments[0]))) + if (! is_file($test . '.php') && $directoryOverride === false && is_dir($test)) { - $this->setDirectory(array_shift($segments), true); + $this->setDirectory($segmentConvert, true); + array_shift($segments); continue; }