Commit 64fd84ff42 for wordpress.org
commit 64fd84ff422348eb39fbf8cd51906c64cd67c926
Author: Sergey Biryukov <sergeybiryukov.ru@gmail.com>
Date: Wed Sep 17 14:44:24 2025 +0000
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.
Built from https://develop.svn.wordpress.org/trunk@60777
git-svn-id: http://core.svn.wordpress.org/trunk@60113 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/Text/Diff.php b/wp-includes/Text/Diff.php
index 1d5b3859c5..a7a79e5080 100644
--- a/wp-includes/Text/Diff.php
+++ b/wp-includes/Text/Diff.php
@@ -223,33 +223,10 @@ class Text_Diff {
* @access protected
*
* @return string A directory name which can be used for temp files.
- * Returns false if one could not be found.
*/
static function _getTempDir()
{
- $tmp_locations = array('/tmp', '/var/tmp', 'c:\WUTemp', 'c:\temp',
- 'c:\windows\temp', 'c:\winnt\temp');
-
- /* Try PHP's upload_tmp_dir directive. */
- $tmp = ini_get('upload_tmp_dir');
-
- /* Otherwise, try to determine the TMPDIR environment variable. */
- if (!strlen($tmp)) {
- $tmp = getenv('TMPDIR');
- }
-
- /* If we still cannot determine a value, then cycle through a list of
- * preset possibilities. */
- while (!strlen($tmp) && count($tmp_locations)) {
- $tmp_check = array_shift($tmp_locations);
- if (@is_dir($tmp_check)) {
- $tmp = $tmp_check;
- }
- }
-
- /* If it is still empty, we have failed, so return false; otherwise
- * return the directory determined. */
- return strlen($tmp) ? $tmp : false;
+ return get_temp_dir();
}
/**
diff --git a/wp-includes/version.php b/wp-includes/version.php
index caa42d9689..702a55bb88 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '6.9-alpha-60776';
+$wp_version = '6.9-alpha-60777';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.