psl icon indicating copy to clipboard operation
psl copied to clipboard

OSX: `Filesystem\create_temporary_file(Env\temp_dir()))` not equivalent to `\tempnam(\sys_get_temp_dir())`

Open bendavies opened this issue 3 years ago • 3 comments

Describe the bug Not a bug as such, but it caused a failure on my testsuite so thought you might want to know about it:

on OSX (or any system where sys_get_temp_dir() is a symlink: Filesystem\create_temporary_file(Env\temp_dir())) not equivalent to \tempnam(\sys_get_temp_dir()).

Filesystem\create_temporary_file(Env\temp_dir())) will return /var/folders/c9/etc... \tempnam(\sys_get_temp_dir()) will return /private/var/folders/c9/etc...

because /var/ is a symlink to /private/var

Expected behavior Not sure really, just FYI.

Environment (please complete the following information):

  • OS: OSX
  • PHP version 8.0

bendavies avatar Nov 09 '21 15:11 bendavies

so it seems tempnam resolves symlink, while Filesystem\create_temporary_file doesn't.

Not sure if we should 🤔 currently create_temporary_file doesn't use tempnam, and i don't really see a gain from using it.

azjezz avatar Nov 09 '21 16:11 azjezz

yep exactly :)

bendavies avatar Nov 09 '21 16:11 bendavies

could call Filesystem\canonicalize(...) on the result

bendavies avatar Nov 09 '21 16:11 bendavies