COMMENTS_TEMPLATE: cannot define a constant twice in PHP
|Reported by:||kitchin||Owned by:||ryan|
A minor PHP issue in wp-includes/comment-template.php in comments_template() :
if ( !defined('COMMENTS_TEMPLATE') || !COMMENTS_TEMPLATE) define('COMMENTS_TEMPLATE', true);
PHP does not allow constants to be re-defined, so the clause "!COMMENTS_TEMPLATE" can have no effect other than raise a warning.
The patch removes the clause.
Normally this warning would happen if comments_template() is called twice by the theme, but the subsequent require() statement would raise an error anyway.
In one edge case it might not raise an error:
- Theme calls comments_template()
- Theme calls comments_template() again with a different parameter or after a different filter is in effect.
So the patch loses a warning in that case.
I grepped the codebase and did not find any similar clause before a define().
The conditional code around the define() was added in this changeset: http://core.trac.wordpress.org/changeset/10953