From 2c161c14cf31fcea64d6da070036c3d16a3828b1 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Fri, 20 Feb 2026 15:28:54 +0000 Subject: [PATCH] Add str_replace(DIRECTORY_SEPARATOR, '/' Signed-off-by: Kamil Tekiela --- src/Error/Error.php | 2 +- tests/unit/Error/ErrorTest.php | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/Error/Error.php b/src/Error/Error.php index 74d96b1c43..bebd8a614f 100644 --- a/src/Error/Error.php +++ b/src/Error/Error.php @@ -238,7 +238,7 @@ class Error extends Message */ public function getFile(): string { - return $this->file; + return str_replace(DIRECTORY_SEPARATOR, '/', $this->file); } /** diff --git a/tests/unit/Error/ErrorTest.php b/tests/unit/Error/ErrorTest.php index 857df14bc9..01dcab17ce 100644 --- a/tests/unit/Error/ErrorTest.php +++ b/tests/unit/Error/ErrorTest.php @@ -9,9 +9,6 @@ use PhpMyAdmin\Tests\AbstractTestCase; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; -use function str_replace; - -use const DIRECTORY_SEPARATOR; use const E_COMPILE_ERROR; use const E_COMPILE_WARNING; use const E_CORE_ERROR; @@ -81,9 +78,7 @@ class ErrorTest extends AbstractTestCase { $this->object->setFile($file); $filePath = $this->object->getFile(); - self::assertStringStartsWith('.' . DIRECTORY_SEPARATOR, $filePath); - /** @psalm-var non-empty-string $expected */ - $expected = str_replace('/', DIRECTORY_SEPARATOR, $expected); + self::assertStringStartsWith('./', $filePath); self::assertStringEndsWith($expected, $filePath); }