Replace
with:
$isWin = 'WIN' === strtoupper(substr(PHP_OS, 0, 3)); /** @var bool $isWin */
foreach ($directories as $directory) {
if (
$directory !== null
&& 0 === strpos($realPath, !$isWin ? $directory : str_replace('/', DIRECTORY_SEPARATOR, $directory))
) {
For other Magento versions:
- For 2.3 ≤ Magento < 2.4.5
- For Magento 2.2.x