Problem/Motivation
\Drupal\Component\FileSystem\FileSystem::getOsTemporaryDirectory() looks for a temp directory in the following order:
- ini_get('upload_tmp_dir');
- (if windows) 'c:\\windows\\temp'
- (if windows) 'c:\\winnt\\temp'
- '/tmp'
- sys_get_temp_dir()
Locally for me this means I use /tmp and not the secure temp directory my php has at /var/folders/6r/j46s2lv14rn97ghzlk4k18d80000gn/T
Proposed resolution
Change the order to
- ini_get('upload_tmp_dir');
- sys_get_temp_dir()
- (if windows) 'c:\\windows\\temp'
- (if windows) 'c:\\winnt\\temp'
- '/tmp'
Remaining tasks
User interface changes
None
Introduced terminology
N/a
API changes
None
Data model changes
None
Release notes snippet
Issue fork drupal-3586645
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3586645-change-order-of
changes, plain diff MR !15559
Comments
Comment #2
alexpottComment #4
andypostI think no tests required for that, OTOH maybe CR required and probably we can get rid of hardcoded paths in follow-up like remove hardcoded path for win/linux
Comment #5
andypostComment #6
andypostComment #7
nicxvan commentedA CR is probably necessary reading the comments on https://www.php.net/manual/en/function.sys-get-temp-dir.php
A lot of them are very old so I'm not sure they are relevant to current php versions.
Comment #8
alexpottI've created a CR - I'm not 100% convinced by the utility as this is going to be very opaque to most but there's no harm.
Comment #9
nicxvan commentedLooks good to me.
I think it's useful since it can change where to check if you're debugging something.
Comment #12
amateescu commentedCommitted 7e69669 to main and 64bdb28 to 11.x. Thanks!