Skip to content
Diamond Sierra

PB-2202: PHP warning

Paul Bunyan code PB-2202 (Warning): PHP warning. What it means and what to do.

Updated · By Diamond Sierra

On this page

What it means

PHP reported a warning. The request carried on, but the code did not do what its author expected.

What to do

The message gives the file, line and owning plugin.

Common causes

  • Reading an array key or variable that isn't set ("Undefined array key", "Undefined variable").
  • Code written for older PHP meeting stricter rules in PHP 8 (for example count() on something that isn't a list).
  • foreach over a value that turned out to be empty or null.
  • A file or remote address that couldn't be opened ("Failed to open stream").
  • Headers sent after output already started ("Cannot modify header information"), often from a stray space or BOM at the top of a PHP file.

How to find and fix it

  1. The message names the file, line and plugin. Warnings don't stop the page, but they mean the code did something its author didn't expect, and they often come before a real failure.
  2. Check whether a plugin update fixes it; warnings after a PHP upgrade usually have one.
  3. A warning repeated thousands of times can slow a site and fill the log. The free debug log analyzer groups repeats into one line with a count.
  4. On a live site keep warnings out of visitors' view: set WP_DEBUG_DISPLAY to false (the wp-config debug settings generator writes the lines).

Details

CodeSeverityGroup
PB-2202WarningPHP