Welcome Guest, Not a member yet? Register   Sign In
Possible discrepancy in FileLocator between Windows and Linux
#7

Okay, I did some further tests to cover most use cases I think (would be nice to have tables here Big Grin):

View name: 'Auth/login'
  Expected Result:   loaded via file path
  Windows:             loaded via file path
  Debian:                loaded via file path

View name: 'Auth\login'
  Expected Result:   File-not-Found-Exception
  Windows:             loaded via file path
  Debian:                File-not-Found-Exception

View name: 'App\Views\Auth\login'
  Expected Result:   loaded via FileLocator
  Windows:             loaded via FileLocator
  Debian:                loaded via FileLocator

View name: 'Myth\Auth\Views\login'
  Expected Result:   loaded via FileLocator
  Windows:             loaded via FileLocator
  Debian:                loaded via FileLocator

As long as nobody is using mixed separators in a single call, this should be it.

Like you said, we could strstr before calling is_file or I would suggest to change line 220 in View\View.php from

if (! is_file($this->renderVars['file']))

to

if (strpos($file, '\\') !== false && ! is_file($this->renderVars['file'])).

That is the way FileLocator checks if a filename is namespaced.
Thinking about is, the strpos check might even be executed at the beginning of the render function, as I think backslashed should always indicate a namespaced filename, in which case we would not need to waste time by checking the concatenated folder path before using FileLocator. Am I overseeing something here?
Reply


Messages In This Thread
RE: Possible discrepancy in FileLocator between Windows and Linux - by aschmitz - 08-17-2020, 12:40 PM



Theme © iAndrew 2016 - Forum software by © MyBB