WordPress.org

Make WordPress Core

Opened 6 months ago

Closed 6 months ago

Last modified 6 months ago

#52821 closed defect (bug) (invalid)

TEMPLATEPATH needs to be removed from WordPress Core File

Reported by: dlinstedt Owned by:
Milestone: Priority: normal
Severity: minor Version: 5.7
Component: Themes Keywords:
Focuses: template Cc:

Description

Error Level: E_WARNING
Message: Use of undefined constant TEMPLATEPATH - assumed 'TEMPLATEPATH' (this will throw an Error in a future version of PHP)
File: /wp-includes/template.php
Line: 666
Referrer: unknown

Issuing a PHP warning, as this constant will disappear in a future version of PHP.

Please fix it.

Change History (3)

#1 @TimothyBlynJacobs
6 months ago

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

Hi @dlinstedt,

Welcome to trac and thanks for the ticket! This isn't an issue in WordPress Core. This would occur if some code on your site is using Theme API functions before the after_setup_theme action.

This trac is for managing issues related to WordPress Core. I'd recommend reaching out to the WordPress Support Forums for help with your site: https://wordpress.org/support/forums/

#2 @SergeyBiryukov
6 months ago

  • Component changed from General to Themes

#3 @SergeyBiryukov
6 months ago

Use of undefined constant TEMPLATEPATH - assumed 'TEMPLATEPATH' (this will throw an Error in a future version of PHP)
...
Issuing a PHP warning, as this constant will disappear in a future version of PHP.

Just to clarify a bit, TEMPLATEPATH is a WordPress constant, not a PHP one, so it does not depend on the PHP version. As noted above, the issue is likely caused by a plugin or theme using WordPress Theme API functions incorrectly.

The "will throw an Error in a future version of PHP" part refers not to this particular constant, but to the fact of using a constant before it's defined, which was deprecated in PHP 7.2:

Unquoted strings that are non-existent global constants are taken to be strings of themselves. This behaviour used to emit an E_NOTICE, but will now emit an E_WARNING. In the next major version of PHP, an Error exception will be thrown instead.

This was implemented in PHP 8.0, see Backward Incompatible Changes:

Attempting to access unqualified constants which are undefined. Previously, unqualified constant accesses resulted in a warning and were interpreted as strings.

Version 0, edited 6 months ago by SergeyBiryukov (next)
Note: See TracTickets for help on using tickets.