[wp-trac] [WordPress Trac] #53282: "A non-numeric value encountered" warning when checking mbstring.func_overload

WordPress Trac noreply at wordpress.org
Wed May 26 15:59:11 UTC 2021


#53282: "A non-numeric value encountered" warning when checking
mbstring.func_overload
----------------------------+---------------------
 Reporter:  SergeyBiryukov  |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  5.8
Component:  General         |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:
----------------------------+---------------------
Description changed by SergeyBiryukov:

Old description:

> Reported by @djbu on [https://ru.wordpress.org/support/topic/a-non-
> numeric-value-encountered-in-wp-includes-pomo-streams-php-on-line-21/
> support forums].
>
> If a web host has the `mbstring.func_overload` PHP value set to something
> other than a numeric string, you'll see warnings like this in the error
> log:
> {{{
> PHP Warning: A non-numeric value encountered in .../wp-
> includes/functions.php on line 6746
> PHP Warning: A non-numeric value encountered in .../wp-
> includes/pomo/streams.php on line 21
> }}}
>
> This is obviously an edge case, but we can easily avoid the warning be
> casting the value to `(int)` before checking.

New description:

 Reported by @djbu on [https://ru.wordpress.org/support/topic/a-non-
 numeric-value-encountered-in-wp-includes-pomo-streams-php-on-line-21/
 support forums].

 If a web host has the `mbstring.func_overload` PHP value set to something
 other than a numeric string (e.g. an empty string instead of the default
 `'0'` value), you'll see warnings like this in the error log:
 {{{
 PHP Warning: A non-numeric value encountered in .../wp-
 includes/functions.php on line 6746
 PHP Warning: A non-numeric value encountered in .../wp-
 includes/pomo/streams.php on line 21
 }}}

 This is obviously an edge case, but we can easily avoid the warning be
 casting the value to `(int)` before checking.

--

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


More information about the wp-trac mailing list