#20955 closed defect (bug) (fixed)
get_file_data() is more strict than get_page_templates() was in 3.3
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 3.4.1 | Priority: | normal |
Severity: | major | Version: | 3.4 |
Component: | Themes | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
get_page_templates() read in a file's contents and then matched '|Template Name:(.*)$|mi'. get_file_data() is much more strict about what it will accept. In particular, this will not work:
<?php /* Template Name: My Template */ ?>
I like the idea of using get_file_data(), but I don't know if it will be tenable to keep using it. We can revert to the same operations in 3.3 inside WP_Theme->get_page_templates() and be much safer.
Change History (8)
#2
@
11 years ago
Yes, we could make it more forgiving, but I'm not sure how much we could get away with, without then breaking other uses by being too liberal in what we accept. Especially since the regular expression for 'Template Name' was as forgiving as it gets. We'll have to come up with a set of tests and then pick a path.
#3
@
11 years ago
Introduced in the main WP_Theme commit, [20029], on February 28. Took a release almost four months later to trigger a bug report.
Is it possible to make get_file_data more forgiving, without breaking other things? Or maybe add a $strict flag to get_file_data to allow it to be more or less strict for this use?