Reputation: 157
I have a Wordpress site running on PHP 7.3 and since updating I am receiving the following error on the front end of the website:
Warning: A non-numeric value encountered in /homepages/36/d362586048/htdocs/genag/wp-includes/formatting.php on line 3378
The code on that line is
$words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY );
Can anyone help with what I should be changing the line to for correcting the error? Thanks.
Upvotes: 0
Views: 356
Reputation: 178
According to this, it is happening when the addition operator is being used on $num_words
.
You could cast $num_words
to an integer to avoid this warning.
$words_array = preg_split( "/[\n\r\t ]+/", $text, (int)$num_words + 1, PREG_SPLIT_NO_EMPTY );
I would suggest identifying why $num_words
isn't an integer first though.
Upvotes: 1