Opened 10 years ago
Last modified 3 years ago
#33388 reviewing defect (bug)
WP_Theme should use get_file_data() for retrieving page templates
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | |
Component: | Themes | Keywords: | needs-testing has-patch needs-refresh |
Focuses: | Cc: |
Description
Currently WP_Theme::get_page_templates() uses a direct regular expression on the result of get_file_contents()
, it should instead use the get_file_data()
helper method we have to interact with file header data.
Currently switching will result in a back-compat break, as some themes have been using headers such as <?php // Template Name: Something ?>
as the header, which get_file_data() doesn't like - See #33387
See r21117 for where we previously did use it temporarily during the 3.4 cycle, but broke due to #33387
Attachments (3)
Change History (15)
#3
follow-up:
↓ 4
@
5 years ago
- Keywords close added
This ticket proposes a "should", but says it is not backward compatible. So why "should" it be changed?
It's not broken, so why change it?
#4
in reply to:
↑ 3
@
4 years ago
- Keywords has-patch added; close removed
- Milestone changed from Awaiting Review to 5.9
- Owner set to SergeyBiryukov
- Status changed from new to reviewing
Replying to joyously:
This ticket proposes a "should", but says it is not backward compatible. So why "should" it be changed?
The backward compatibility concerns are addressed in [51182] / #33387, so this can now be addressed as well.
Why? Using an existing function instead of partially duplicating its functionality should make future maintenance easier.
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
3 years ago
#6
@
3 years ago
- Milestone changed from 5.9 to 6.0
As per today's bug scrub, let's move this ticket to the next milestone for proper review/refresh.
@
3 years ago
Patch refreshed against trunk. Added missing {}
in if
statements, removed extraneous semi-colon + PHPCS fixes.
This ticket was mentioned in Slack in #core by mike. View the logs.
3 years ago
This ticket was mentioned in PR #2538 on WordPress/wordpress-develop by peterwilsoncc.
3 years ago
#8
@cosdev's patch https://core.trac.wordpress.org/ticket/33388
#9
@
3 years ago
- Keywords needs-refresh added
I created a pull request based in 33888.3.diff to get the tests running but there are few errors and failures that will need a little investigation.
This ticket was mentioned in Slack in #core by chaion07. View the logs.
3 years ago
peterwilsoncc commented on PR #2538:
3 years ago
#11
Closing this as it was just to get tests running.
depends on #33387