Index: wp-includes/theme.php
===================================================================
--- wp-includes/theme.php	(revision 19934)
+++ wp-includes/theme.php	(working copy)
@@ -14,7 +14,7 @@
  * @return bool true if a child theme is in use, false otherwise.
  **/
 function is_child_theme() {
-	return ( TEMPLATEPATH !== STYLESHEETPATH );
+	return ( get_stylesheet() !== get_template() );
 }
 
 /**
@@ -23,8 +23,7 @@
  * The theme name that the administrator has currently set the front end theme
  * as.
  *
- * For all extensive purposes, the template name and the stylesheet name are
- * going to be the same for most cases.
+ * The template name and stylesheet name differ when a child theme is in use.
  *
  * @since 1.5.0
  * @uses apply_filters() Calls 'stylesheet' filter on stylesheet name.
@@ -32,7 +31,7 @@
  * @return string Stylesheet name.
  */
 function get_stylesheet() {
-	return apply_filters('stylesheet', get_option('stylesheet'));
+	return get_option( 'stylesheet' );
 }
 
 /**
@@ -125,10 +124,24 @@
  * @return string Template name.
  */
 function get_template() {
-	return apply_filters('template', get_option('template'));
+	return get_option( 'template' );
 }
 
 /**
+ * Applies the 'stylesheet' and 'template' filters to option calls.
+ *
+ * @since 3.4.0
+ * @access private
+ */
+function _stylesheet_template_option_filter( $value ) {
+	if ( 'stylesheet' == current_filter() )
+		return apply_filters( 'stylesheet', $value );
+	return apply_filters( 'template', $value );
+}
+add_action( 'option_stylesheet', '_stylesheet_template_option_filter', 100 );
+add_action( 'option_stylesheet', '_stylesheet_template_option_filter', 100 );
+
+/**
  * Retrieve current theme directory.
  *
  * @since 1.5.0
@@ -1063,7 +1076,7 @@
 /**
  * Retrieve the name of the highest priority template file that exists.
  *
- * Searches in the STYLESHEETPATH before TEMPLATEPATH so that themes which
+ * Searches in the stylesheet path before template path so that themes which
  * inherit from a parent theme can just overload one file.
  *
  * @since 2.7.0
@@ -1078,11 +1091,11 @@
 	foreach ( (array) $template_names as $template_name ) {
 		if ( !$template_name )
 			continue;
-		if ( file_exists(STYLESHEETPATH . '/' . $template_name)) {
-			$located = STYLESHEETPATH . '/' . $template_name;
+		if ( file_exists( get_stylesheet() . '/' . $template_name)) {
+			$located = get_stylesheet() . '/' . $template_name;
 			break;
-		} else if ( file_exists(TEMPLATEPATH . '/' . $template_name) ) {
-			$located = TEMPLATEPATH . '/' . $template_name;
+		} else if ( file_exists( get_template() . '/' . $template_name) ) {
+			$located = get_template() . '/' . $template_name;
 			break;
 		}
 	}
@@ -1153,13 +1166,13 @@
 	if ( validate_file($_GET['template']) )
 		return;
 
-	add_filter( 'template', '_preview_theme_template_filter' );
+	add_filter( 'option_template', '_preview_theme_template_filter' );
 
 	if ( isset($_GET['stylesheet']) ) {
 		$_GET['stylesheet'] = preg_replace('|[^a-z0-9_./-]|i', '', $_GET['stylesheet']);
 		if ( validate_file($_GET['stylesheet']) )
 			return;
-		add_filter( 'stylesheet', '_preview_theme_stylesheet_filter' );
+		add_filter( 'option_stylesheet', '_preview_theme_stylesheet_filter' );
 	}
 
 	// Prevent theme mods to current theme being used on theme being previewed
