From c03a0bea8d264b89c77c729ada1305f406272ce3 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 14 Aug 2019 17:18:55 +0000 Subject: [PATCH] Posts, Post Types: In `wp_trim_words()` make sure the `$num_words` parameter is always an integer, as documented, to avoid a PHP warning. Props donmhico, pikamander2. Fixes #47867. Built from https://develop.svn.wordpress.org/trunk@45796 git-svn-id: http://core.svn.wordpress.org/trunk@45607 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/formatting.php | 3 ++- wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 4f2bbc2a8c..a2cd12f935 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -3728,7 +3728,7 @@ function wp_trim_excerpt( $text = '', $post = null ) { * * @param int $number The maximum number of words. Default 55. */ - $excerpt_length = apply_filters( 'excerpt_length', $excerpt_length ); + $excerpt_length = (int) apply_filters( 'excerpt_length', $excerpt_length ); /** * Filters the string in the "more" link displayed after a trimmed excerpt. @@ -3773,6 +3773,7 @@ function wp_trim_words( $text, $num_words = 55, $more = null ) { $original_text = $text; $text = wp_strip_all_tags( $text ); + $num_words = (int) $num_words; /* * translators: If your word count is based on single characters (e.g. East Asian characters), diff --git a/wp-includes/version.php b/wp-includes/version.php index 4ed3866e88..3eefdc0bcb 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-alpha-45795'; +$wp_version = '5.3-alpha-45796'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.