Skip to content

Commit 7d99b27

Browse files
committed
Grouped backports for the 6.7 branch.
- Customize: Introduce a fix for themes that pass a stringable object through the `template_include` filter despite it being documented as only accepting a string. - Update version string following r61902. Props dmsnell, desrosj, westonruter. git-svn-id: https://develop.svn.wordpress.org/branches/6.7@61923 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 8b09f22 commit 7d99b27

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/wp-includes/class-wp-block-patterns-registry.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ private function get_content( $pattern_name, $outside_init_only = false ) {
174174
$patterns = &$this->registered_patterns;
175175
}
176176

177-
$pattern_path = realpath( $patterns[ $pattern_name ]['filePath'] ?? '' );
177+
$file_path = $patterns[ $pattern_name ]['filePath'] ?? '';
178+
$is_stringy = is_string( $file_path ) || ( is_object( $file_path ) && method_exists( $file_path, '__toString' ) );
179+
$pattern_path = $is_stringy ? realpath( (string) $file_path ) : null;
178180
if (
179181
! isset( $patterns[ $pattern_name ]['content'] ) &&
180182
is_string( $pattern_path ) &&

src/wp-includes/interactivity-api/class-wp-interactivity-api.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ private function data_wp_bind_processor( WP_Interactivity_API_Directives_Process
827827
__( 'Binding event handler attributes is not supported. Please use "%s" instead.' ),
828828
esc_attr( 'data-wp-on--' . substr( $bound_attribute, 2 ) )
829829
),
830-
'x.y.z'
830+
'6.9.2'
831831
);
832832
continue;
833833
}

src/wp-includes/template-loader.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@
101101
*
102102
* @param string $template The path of the template to include.
103103
*/
104-
$template = apply_filters( 'template_include', $template );
105-
$template = is_string( $template ) ? realpath( $template ) : null;
104+
$template = apply_filters( 'template_include', $template );
105+
$is_stringy = is_string( $template ) || ( is_object( $template ) && method_exists( $template, '__toString' ) );
106+
$template = $is_stringy ? realpath( (string) $template ) : null;
106107
if (
107108
is_string( $template ) &&
108109
( str_ends_with( $template, '.php' ) || str_ends_with( $template, '.html' ) ) &&

0 commit comments

Comments
 (0)