WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#14315 closed defect (bug) (fixed)

comments_template() generates bad theme-compat path

Reported by: dougal Owned by: westi
Milestone: 3.0.1 Priority: normal
Severity: major Version: 3.0
Component: Template Keywords: has-patch
Focuses: Cc:

Description

In the final fallback case of comments_template() it attempts to include theme-compat/comments.php, however, the path it generates is incorrect, because it fails to prepend ABSPATH.

This causes an error to be output to the page in older themes that rely on this feature.

Warning: require(wp-includes/theme-compat/comments.php): failed to open stream: 
No such file or directory in 
/var/www/vhosts/example.com/wordpress/wp-includes/comment-template.php on line 920 
Fatal error: require(): Failed opening required 'wp-includes/theme-compat/comments.php' 
(include_path='.:/usr/share/php:/usr/share/pear') 
in /var/www/vhosts/example.com/wordpress/wp-includes/comment-template.php on line 920

Attachments (1)

14315-comment-template.diff (509 bytes) - added by dougal 4 years ago.
Fix theme-compat.php path

Download all attachments as: .zip

Change History (10)

dougal4 years ago

Fix theme-compat.php path

comment:1 nacin4 years ago

  • Milestone changed from Awaiting Review to 3.0.1

comment:2 westi4 years ago

  • Owner set to westi
  • Status changed from new to accepted

My bad.

comment:3 westi4 years ago

Confusingly this all works in my test install as I must be lucky with the php path.

There are a number of places where the ABSPATH needs adding, working on this now.

comment:4 westi4 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [15433]) Fix the theme compat file require paths to be fully absolute so they don't rely on a particular php path to work. Fixes #14315 for trunk props dougal.

comment:5 westi4 years ago

(In [15434]) Fix the theme compat file require paths to be fully absolute so they don't rely on a particular php path to work. Fixes #14315 for 3.0 branch
props dougal.

comment:6 follow-up: scribu4 years ago

Erm, what is the purpose of error_log( $_template_file ); in [15433]?

comment:7 in reply to: ↑ 6 westi4 years ago

Replying to scribu:

Erm, what is the purpose of error_log( $_template_file ); in [15433]?

oops

comment:8 westi4 years ago

(In [15435]) Remove debug cruft. See #14315 props scribu.

comment:9 westi4 years ago

(In [15436]) Remove debug cruft. See #14315 props scribu.

Note: See TracTickets for help on using tickets.