[wp-trac] [WordPress Trac] #42034: PHP 7.1 PHP Warning: A non-numeric value encountered wp-includes/formatting.php on line 3362

WordPress Trac noreply at wordpress.org
Fri Sep 29 15:53:59 UTC 2017


#42034: PHP 7.1 PHP Warning:  A non-numeric value encountered wp-
includes/formatting.php on line 3362
-------------------------------+------------------------------
 Reporter:  laserjobs          |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Formatting         |     Version:  4.8.2
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------
Changes (by johnbillion):

 * keywords:   => reporter-feedback


Comment:

 Thanks for the report, @laserjobs.

 The code in question is
 [https://core.trac.wordpress.org/browser/tags/4.8.2/src/wp-
 includes/formatting.php?marks=3362#L3343 this line] within
 `wp_trim_words()`:

 {{{
 $words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1,
 PREG_SPLIT_NO_EMPTY );
 }}}

 If the `$num_words` variable is not numeric, it would trigger this error.

 I've checked every use of `wp_trim_words()` in WordPress core and it only
 uses numeric values for this parameter. Could you try switching to one of
 the default themes such as TwentySeventeen and see if the issue goes away?
 If not, could you try deactivating your plugins one by one to see if you
 can pinpoint the issue?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42034#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list