[wp-trac] [WordPress Trac] #52821: TEMPLATEPATH needs to be removed from WordPress Core File

WordPress Trac noreply at wordpress.org
Mon Mar 15 21:16:59 UTC 2021


#52821: TEMPLATEPATH  needs to be removed from WordPress Core File
--------------------------+-----------------------
 Reporter:  dlinstedt     |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Themes        |     Version:  5.7
 Severity:  minor         |  Resolution:  invalid
 Keywords:                |     Focuses:  template
--------------------------+-----------------------

Comment (by SergeyBiryukov):

 > 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
 [https://www.php.net/manual/en/migration72.deprecated.php 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
 [https://www.php.net/manual/en/migration80.incompatible.php Backward
 Incompatible Changes]:
 > Attempting to access unqualified constants which are undefined.
 Previously, unqualified constant accesses resulted in a warning and were
 interpreted as strings.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52821#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list