Skip to content

Commit 8b2ff11

Browse files
External Libraries: Adopt standard get_temp_dir() in Text_Diff::_getTempDir().
This aims to bring more consistency with the rest of core, and more closely mirrors the similar changes upstream to use `sys_get_temp_dir()`. The potential `false` return value was not checked by the only caller in `Text_Diff_Engine_shell::diff()`. Follow-up to [7747], [48464], [49185], [60776]. Props TimoTijhof, apermo, SergeyBiryukov. Fixes #63711. git-svn-id: https://develop.svn.wordpress.org/trunk@60777 602fd350-edb4-49c9-b593-d223f7449a82
1 parent a8e4f05 commit 8b2ff11

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

src/wp-includes/Text/Diff.php

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -223,33 +223,10 @@ static function trimNewlines(&$line, $key)
223223
* @access protected
224224
*
225225
* @return string A directory name which can be used for temp files.
226-
* Returns false if one could not be found.
227226
*/
228227
static function _getTempDir()
229228
{
230-
$tmp_locations = array('/tmp', '/var/tmp', 'c:\WUTemp', 'c:\temp',
231-
'c:\windows\temp', 'c:\winnt\temp');
232-
233-
/* Try PHP's upload_tmp_dir directive. */
234-
$tmp = ini_get('upload_tmp_dir');
235-
236-
/* Otherwise, try to determine the TMPDIR environment variable. */
237-
if (!strlen($tmp)) {
238-
$tmp = getenv('TMPDIR');
239-
}
240-
241-
/* If we still cannot determine a value, then cycle through a list of
242-
* preset possibilities. */
243-
while (!strlen($tmp) && count($tmp_locations)) {
244-
$tmp_check = array_shift($tmp_locations);
245-
if (@is_dir($tmp_check)) {
246-
$tmp = $tmp_check;
247-
}
248-
}
249-
250-
/* If it is still empty, we have failed, so return false; otherwise
251-
* return the directory determined. */
252-
return strlen($tmp) ? $tmp : false;
229+
return get_temp_dir();
253230
}
254231

255232
/**

0 commit comments

Comments
 (0)