WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#10953 closed defect (bug) (fixed)

Cannot select Page template after r12025

Reported by: demetris Owned by:
Milestone: 2.9 Priority: normal
Severity: critical Version: 2.9
Component: Template Keywords: has-patch tested
Focuses: Cc:

Description

Starting with r12025, I cannot select template for a Page. In the Attributes metabox, instead of the menu to select a template, I get a log list of warnings like the following:

Warning: file(/PATH/TO/wp-content/themes/sandbox/sitemap.php) [function.file]: failed to open stream:
No such file or directory in /PATH/TO/wp-admin/includes/theme.php on line 134

Warning: implode() [function.implode]: Bad arguments.
in /PATH/TO/wp-admin/includes/theme.php on line 134

Up to r12024 template selection is OK.

Confirmed on two different server setups.

Attachments (1)

10953.diff (512 bytes) - added by sivel 8 years ago.
$template contains the full path of the template. Don't prepend WP_CONTENT_DIR to the template path.

Download all attachments as: .zip

Change History (8)

#1 @mrmist
8 years ago

For me, edit-pages doesn't load at all.

Some of the warnings -

PHP Warning: file(E:\webpage\svn\trunk/wp-contentE:\webpage\svn\trunk/wp-content/themes/default/404.php): failed to open stream: Invalid argument in E:\webpage\svn\trunk\wp-admin\includes\theme.php on line 134 PHP Warning: implode(): Invalid arguments passed in E:\webpage\svn\trunk\wp-admin\includes\theme.php on line 134 PHP Warning: file(E:\webpage\svn\trunk/wp-contentE:\webpage\svn\trunk/wp-content/themes/default/archive.php): failed to open stream: Invalid argument in E:\webpage\svn\trunk\wp-admin\includes\theme.php on line 134

....

PHP Warning: implode(): Invalid arguments passed in E:\webpage\svn\trunk\wp-admin\includes\theme.php on line 134 PHP Warning: file(E:\webpage\svn\trunk/wp-contentE:\webpage\svn\trunk/wp-content/themes/default/single.php): failed to open stream: Invalid argument in E:\webpage\svn\trunk\wp-admin\includes\theme.php on line 134 PHP Warning: implode(): Invalid arguments passed in E:\webpage\svn\trunk\wp-admin\includes\theme.php on line 134

#2 @scribu
8 years ago

  • Component changed from Themes to Administration
  • Keywords needs-patch added
  • Severity changed from normal to critical

Confirmed on r12031.

#3 @dd32
8 years ago

This comes down to Template Files now holding a absolute path to the template files.. Not the relative directory as previously expected.

The simple solution is to remove the usage of WP_CONTENT_DIR in wp-admin\includes\theme.php on line 134, The other option, is for returning relative files again, which'll require passing some relative-paths around a fair bit..

@sivel
8 years ago

$template contains the full path of the template. Don't prepend WP_CONTENT_DIR to the template path.

#4 @sivel
8 years ago

  • Cc matt@… added
  • Component changed from Administration to Template
  • Keywords has-patch tested added; needs-patch removed

#5 @demetris
8 years ago

  • Cc dkikizas@… added

sivel’s patch fixes the problem for me too.

#6 @mrmist
8 years ago

Patch seems to work for me also.

#7 @westi
8 years ago

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

(In [12033]) Page Templates now have there full path specified so no need to prepend WP_CONTENT_DIR. Fixes #10953 props sivel.

Note: See TracTickets for help on using tickets.