diff --git a/app/Views/errors/html/error_exception.php b/app/Views/errors/html/error_exception.php
index 693afed491f5..4ddeac1a2ec4 100644
--- a/app/Views/errors/html/error_exception.php
+++ b/app/Views/errors/html/error_exception.php
@@ -30,7 +30,7 @@
-
= esc(static::cleanPath($file, $line)) ?> at line = esc($line) ?>
+
= esc(clean_path($file)) ?> at line = esc($line) ?>
@@ -64,12 +64,12 @@
-
+
{PHP internal code}
@@ -350,7 +350,7 @@
- - = esc(static::cleanPath($file)) ?>
+ - = esc(clean_path($file)) ?>
diff --git a/system/Debug/Exceptions.php b/system/Debug/Exceptions.php
index a65be7a2ad2f..0dbc7e293ae9 100644
--- a/system/Debug/Exceptions.php
+++ b/system/Debug/Exceptions.php
@@ -318,6 +318,8 @@ protected function determineCodes(Throwable $exception): array
/**
* This makes nicer looking paths for the error output.
+ *
+ * @deprecated Use dedicated `clean_path()` function.
*/
public static function cleanPath(string $file): string
{
diff --git a/system/Debug/Toolbar/Collectors/BaseCollector.php b/system/Debug/Toolbar/Collectors/BaseCollector.php
index 5d8d39ff169f..e8aaad9ba115 100644
--- a/system/Debug/Toolbar/Collectors/BaseCollector.php
+++ b/system/Debug/Toolbar/Collectors/BaseCollector.php
@@ -11,8 +11,6 @@
namespace CodeIgniter\Debug\Toolbar\Collectors;
-use CodeIgniter\Debug\Exceptions;
-
/**
* Base Toolbar collector
*/
@@ -174,13 +172,13 @@ public function display()
}
/**
- * Clean Path
- *
* This makes nicer looking paths for the error output.
+ *
+ * @deprecated Use the dedicated `clean_path()` function.
*/
public function cleanPath(string $file): string
{
- return Exceptions::cleanPath($file);
+ return clean_path($file);
}
/**
diff --git a/system/Debug/Toolbar/Collectors/Files.php b/system/Debug/Toolbar/Collectors/Files.php
index d6aefd2c3fe9..ea14dcfd1ec3 100644
--- a/system/Debug/Toolbar/Collectors/Files.php
+++ b/system/Debug/Toolbar/Collectors/Files.php
@@ -58,7 +58,7 @@ public function display(): array
$userFiles = [];
foreach ($rawFiles as $file) {
- $path = $this->cleanPath($file);
+ $path = clean_path($file);
if (strpos($path, 'SYSTEMPATH') !== false) {
$coreFiles[] = [
diff --git a/tests/system/Debug/ExceptionsTest.php b/tests/system/Debug/ExceptionsTest.php
index 08d521ede2f4..247629933c69 100644
--- a/tests/system/Debug/ExceptionsTest.php
+++ b/tests/system/Debug/ExceptionsTest.php
@@ -61,36 +61,4 @@ public function testDetermineCodes(): void
$this->assertSame([500, 1], $determineCodes(new RuntimeException('That.', 600)));
$this->assertSame([404, 1], $determineCodes(new RuntimeException('There.', 404)));
}
-
- /**
- * @dataProvider dirtyPathsProvider
- */
- public function testCleanPaths(string $file, string $expected): void
- {
- $this->assertSame($expected, Exceptions::cleanPath($file));
- }
-
- public function dirtyPathsProvider()
- {
- $ds = DIRECTORY_SEPARATOR;
-
- yield from [
- [
- APPPATH . 'Config' . $ds . 'App.php',
- 'APPPATH' . $ds . 'Config' . $ds . 'App.php',
- ],
- [
- SYSTEMPATH . 'CodeIgniter.php',
- 'SYSTEMPATH' . $ds . 'CodeIgniter.php',
- ],
- [
- VENDORPATH . 'autoload.php',
- 'VENDORPATH' . $ds . 'autoload.php',
- ],
- [
- FCPATH . 'index.php',
- 'FCPATH' . $ds . 'index.php',
- ],
- ];
- }
}
diff --git a/user_guide_src/source/changelogs/v4.2.0.rst b/user_guide_src/source/changelogs/v4.2.0.rst
index 3d2a2223350f..395408641e9f 100644
--- a/user_guide_src/source/changelogs/v4.2.0.rst
+++ b/user_guide_src/source/changelogs/v4.2.0.rst
@@ -40,6 +40,7 @@ Deprecations
************
- ``CodeIgniter\Database\SQLSRV\Connection::getError()`` is deprecated. Use ``CodeIgniter\Database\SQLSRV\Connection::error()`` instead.
+- ``CodeIgniter\Debug\Exceptions::cleanPath()`` and ``CodeIgniter\Debug\Toolbar\Collectors\BaseCollector::cleanPath()`` are deprecated. Use the ``clean_path()`` function instead.
Bugs Fixed
**********