Merge pull request #20145 from kamil-tekiela/str_replace-DIRECTORY_SEPARATOR

Add str_replace(DIRECTORY_SEPARATOR, '/'
This commit is contained in:
Maurício Meneghini Fauth 2026-03-17 13:55:18 -03:00 committed by GitHub
commit e2bc20eeb0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 7 deletions

View File

@ -238,7 +238,7 @@ class Error extends Message
*/
public function getFile(): string
{
return $this->file;
return str_replace(DIRECTORY_SEPARATOR, '/', $this->file);
}
/**

View File

@ -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;
@ -70,9 +67,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);
}