Themes: Make sure `get_file_data()` recognizes headers prefixed by `<?php` tag.
This allows for using headers in the format of `<?php // Template Name: Something ?>`, which previously could not be recognized correctly. Props dd32, m_uysl, thomas-vitale, boblinthorst. Fixes #33387. Built from https://develop.svn.wordpress.org/trunk@51182 git-svn-id: http://core.svn.wordpress.org/trunk@50791 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
87c740b086
commit
e127bcde70
|
@ -6287,7 +6287,7 @@ function get_file_data( $file, $default_headers, $context = '' ) {
|
|||
}
|
||||
|
||||
foreach ( $all_headers as $field => $regex ) {
|
||||
if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] ) {
|
||||
if ( preg_match( '/^(?:[ \t]*<\?php)?[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] ) {
|
||||
$all_headers[ $field ] = _cleanup_header_comment( $match[1] );
|
||||
} else {
|
||||
$all_headers[ $field ] = '';
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.8-beta2-51181';
|
||||
$wp_version = '5.8-beta2-51182';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue