diff --git a/wp-includes/class-wp-block-patterns-registry.php b/wp-includes/class-wp-block-patterns-registry.php index 9d25e850e3..6f25583f47 100644 --- a/wp-includes/class-wp-block-patterns-registry.php +++ b/wp-includes/class-wp-block-patterns-registry.php @@ -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 ) && diff --git a/wp-includes/interactivity-api/class-wp-interactivity-api.php b/wp-includes/interactivity-api/class-wp-interactivity-api.php index 38330b2cd0..0b4de8c792 100644 --- a/wp-includes/interactivity-api/class-wp-interactivity-api.php +++ b/wp-includes/interactivity-api/class-wp-interactivity-api.php @@ -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 ); diff --git a/wp-includes/template-loader.php b/wp-includes/template-loader.php index e7d02c10d2..1853fef519 100644 --- a/wp-includes/template-loader.php +++ b/wp-includes/template-loader.php @@ -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' ) ) &&