﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	focuses	prnumber
48199	Check for whether the themes directory writable is incorrect when the current theme is symlinked into the theme directory	pbiron		"To test whether the theme directory is writable,[https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes/class-wp-debug-data.php#L322 WP_Debug_Data::debug_data(), L322] does:

{{{#!php
$is_writable_template_directory = wp_is_writable( get_template_directory() . '/..' );
}}}

If the current theme exists outside of `ABSPATH` and is symlink'd into `ABSPATH . 'wp-content/themes` (which I do for all the bundled themes for all sites on my local dev machine) then what is actually being checked is whether that directory outside of `ABSPATH` is writable, not whether the theme directory is writable.

Changing that line to:

{{{#!php
$is_writable_template_directory = wp_is_writable( dirname( get_template_directory() ) );
}}}

correctly tests whether the theme directory is writable.

Additionally, when running on a Windows machine, `wp_is_writable()` calls `win_is_writable()`, which creates and then unlinks a tmp file.  Because of the directory traversal in the path, the unlink fails when the template directory is a symlink...which leaves the tmp file in the parent directory of the symlink'd theme resides outside of `ABSPATH`.  Changing the argument to `wp_is_writable()` to use `dirname()` instead of directory traversal also fixes that problem."	defect (bug)	new	normal	Awaiting Review	Site Health		normal		2nd-opinion			
