Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#45642 closed defect (bug) (invalid)

function is_child_theme() bug

Reported by: samet5's profile samet5 Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.0.1
Component: Themes Keywords:
Focuses: Cc:

Description

<?php
function is_child_theme() {
        return ( TEMPLATEPATH !== STYLESHEETPATH );
}

needs to get replaced in:

<?php
function is_child_theme() {
        return ( 'TEMPLATEPATH' !== 'STYLESHEETPATH' );
}

Change History (4)

#1 @samet5
5 years ago

/wp-includes/theme.php

#2 @swissspidy
5 years ago

  • Keywords ? removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Hi, and welcome to WordPress Trac!

Why do you think this needs to be changed?

TEMPLATEPATH !== STYLESHEETPATH compares the two constants TEMPLATEPATH and STYLESHEETPATH, which can have any value.

On the other hand, 'TEMPLATEPATH' !== 'STYLESHEETPATH' compares the two strings "TEMPLATEPATH" and "STYLESHEETPATH", which will never be the same.

#3 @samet5
5 years ago

I think this will not work in newer php versions

#4 @SergeyBiryukov
5 years ago

Comparing constants should work in any PHP version, I don't see an issue here.

Note: See TracTickets for help on using tickets.