WordPress.org

Make WordPress Core

Opened 2 months ago

Closed 2 months ago

#48100 closed defect (bug) (invalid)

the quotes around those two constants are missing causing PHP error

Reported by: feminatzi Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Themes Keywords:
Focuses: Cc:
PR Number:

Description (last modified by SergeyBiryukov)

wp-includes/theme.php

@@ -150,7 +150,7 @@ function wp_clean_themes_cache( $clear_update_cache = true ) {
	 * @return bool true if a child theme is in use, false otherwise.
	 */
	function is_child_theme() {
		return ( TEMPLATEPATH !== STYLESHEETPATH );
		return ( 'TEMPLATEPATH' !== 'STYLESHEETPATH' );
	}

the quotes around those two constants are missing causing PHP error

Change History (3)

#1 @ayeshrajans
2 months ago

Hello @feminatzi - Welcome to WordPress Trac!

In PHP, an unquoted string like the ones you have in the ticket description are interpreted as PHP constants (https://www.php.net/manual/en/language.constants.syntax.php).

If the constants are not prior declared, you will indeed see errors.

In a healthy site, these two constants would be declared before any user code is executed, so no errors are shown. The unquoted code in fact is the correct one; I think you have a theme or a plugin that races this declaration.

#2 @SergeyBiryukov
2 months ago

  • Component changed from General to Themes
  • Description modified (diff)
  • Keywords close added

Hi there, thanks for the report!

As noted above, the current code is correct. The constants are defined in wp_templating_constants() and should not be compared as strings.

The issue most likely comes from a plugin or theme.

#3 @SergeyBiryukov
2 months ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.