Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#53282 closed defect (bug) (fixed)

"A non-numeric value encountered" warning when checking mbstring.func_overload

Reported by: SergeyBiryukov Owned by: SergeyBiryukov
Priority: normal Milestone: 5.8
Component: General Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description (last modified by SergeyBiryukov)

Reported by @djbu on 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 by casting the value to (int) before checking.

Attachments (1)

53282.diff (1.7 KB ) - added by SergeyBiryukov 5 years ago.

Download all attachments as: .zip

Change History (4)

@SergeyBiryukov
5 years ago

#1 @SergeyBiryukov
5 years ago

  • Description modified (diff)

#2 @SergeyBiryukov
5 years ago

  • Description modified (diff)

#3 @SergeyBiryukov
5 years ago

  • Owner set to SergeyBiryukov
  • Resolutionfixed
  • Status newclosed

In 51032:

General: Avoid a PHP warning when checking the mbstring.func_overload PHP value.

This avoids "A non-numeric value encountered" warning when mbstring.func_overload is set to something other than a numeric string, e.g. an empty string instead of the default '0' value.

Props djbu.
Fixes #53282.

Note: See TracTickets for help on using tickets.