Replace the code:
with the following one:
$isWin = 'WIN' === strtoupper(substr(PHP_OS, 0, 3)); /** @var bool $isWin */
foreach ($directories as $directory) {
if (0 === strpos($realPath, !$isWin ? $directory : str_replace('/', DIRECTORY_SEPARATOR, $directory))) {
For other Magento versions:
- For Magento ≥ 2.4.5
- For Magento 2.2.x
samair_ali
(Samair Ali)
3
hi tried it but still no success any other solution ?
samair_ali
(Samair Ali)
4
and i am using magento 2.3
It always work for me. Re-check your code.
blanginoe
(Erick Blangino)
6
for magento 2.2.9
$isWin = 'WIN' === strtoupper(substr(PHP_OS, 0, 3)); /** @var bool $isWin */
foreach ($directories as $directory) {
if (0 === strpos($this->fileDriver->getRealPath($path),
!$isWin ? $directory : $this->fileDriver->getRealPath($directory))
) {
return true;
}
}
1 Like
The same fix works for Magento 2.4.0.
1 Like