Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#53282 closed defect (bug) (fixed)

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

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

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 3 years ago.

Download all attachments as: .zip

Change History (4)

@SergeyBiryukov
3 years ago

#1 @SergeyBiryukov
3 years ago

  • Description modified (diff)

#2 @SergeyBiryukov
3 years ago

  • Description modified (diff)

#3 @SergeyBiryukov
3 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

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.