Grouped backports for the 6.8 branch.

- Interactivity API: Skip binding event handler attributes. The corresponding `data-wp-on--` attribute should be used instead.
- 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.



Built from https://develop.svn.wordpress.org/branches/6.8@61922


git-svn-id: http://core.svn.wordpress.org/branches/6.8@61204 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson
2026-03-11 00:47:34 +00:00
parent df4877c29a
commit 337ffc7ebe
3 changed files with 20 additions and 3 deletions

View File

@@ -174,7 +174,9 @@ final class WP_Block_Patterns_Registry {
$patterns = &$this->registered_patterns;
}
$pattern_path = realpath( $patterns[ $pattern_name ]['filePath'] ?? '' );
$file_path = $patterns[ $pattern_name ]['filePath'] ?? '';
$is_stringy = is_string( $file_path ) || ( is_object( $file_path ) && method_exists( $file_path, '__toString' ) );
$pattern_path = $is_stringy ? realpath( (string) $file_path ) : null;
if (
! isset( $patterns[ $pattern_name ]['content'] ) &&
is_string( $pattern_path ) &&

View File

@@ -868,6 +868,20 @@ final class WP_Interactivity_API {
return;
}
// Skip if the bound attribute is an event handler.
if ( str_starts_with( $bound_attribute, 'on' ) ) {
_doing_it_wrong(
__METHOD__,
sprintf(
/* translators: %s: The directive, e.g. data-wp-on--click. */
__( 'Binding event handler attributes is not supported. Please use "%s" instead.' ),
esc_attr( 'data-wp-on--' . substr( $bound_attribute, 2 ) )
),
'6.8.5'
);
continue;
}
$attribute_value = $p->get_attribute( $attribute_name );
$result = $this->evaluate( $attribute_value );

View File

@@ -101,8 +101,9 @@ if ( wp_using_themes() ) {
*
* @param string $template The path of the template to include.
*/
$template = apply_filters( 'template_include', $template );
$template = is_string( $template ) ? realpath( $template ) : null;
$template = apply_filters( 'template_include', $template );
$is_stringy = is_string( $template ) || ( is_object( $template ) && method_exists( $template, '__toString' ) );
$template = $is_stringy ? realpath( (string) $template ) : null;
if (
is_string( $template ) &&
( str_ends_with( $template, '.php' ) || str_ends_with( $template, '.html' ) ) &&