Skip to content

Windows separator fix on Magento 2.3 #19480

@vincent-bosche

Description

@vincent-bosche

Preconditions (*)

  1. Magento 2.3.0 (fresh installation from composer)
  2. Windows only

Steps to reproduce (*)

  1. Open any URL in frontend or backend

Expected result (*)

  1. The correct output

Actual result (*)

Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: '[..]/vendor/magento/module-theme/view/frontend/templates/page/js/require_js.phtml' in module: '' block's name: 'require.js'
#0 [..]\vendor\magento\framework\View\Element\Template.php(301): Magento\Framework\View\Element\Template->fetchView('C:/www/cardio_t...')
#1 [..]\vendor\magento\framework\View\Element\AbstractBlock.php(668): Magento\Framework\View\Element\Template->_toHtml()
#2 [..]\vendor\magento\framework\View\Result\Page.php(249): Magento\Framework\View\Element\AbstractBlock->toHtml()
#3 [..]\vendor\magento\framework\View\Result\Layout.php(171): Magento\Framework\View\Result\Page->render(Object(Magento\Framework\App\Response\Http\Interceptor))
#4 [..]\vendor\magento\framework\Interception\Interceptor.php(58): Magento\Framework\View\Result\Layout->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#5 [..]\vendor\magento\framework\Interception\Interceptor.php(138): Magento\Framework\View\Result\Page\Interceptor->___callParent('renderResult', Array)
#6 [..]\vendor\magento\framework\Interception\Interceptor.php(153): Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Response\Http\Interceptor))
#7 [..]\generated\code\Magento\Framework\View\Result\Page\Interceptor.php(39): Magento\Framework\View\Result\Page\Interceptor->___callPlugins('renderResult', Array, Array)
#8 [..]\vendor\magento\framework\App\Http.php(139): Magento\Framework\View\Result\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#9 [..]\vendor\magento\framework\App\Bootstrap.php(258): Magento\Framework\App\Http->launch()
#10 [..]\index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#11 {main}
  1. Magento\Framework\View\Element\Template\File\Validator function isPathInDirectories: Windows uses "\" as separator, the array "directories" contains entries with "/" as separator, so the check will always fail.
    $realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path)); could be a solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: Format is validGate 1 Passed. Automatic verification of issue format passed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions