PB-2202: PHP warning
Paul Bunyan code PB-2202 (Warning): PHP warning. What it means and what to do.
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). foreachover a value that turned out to be empty ornull.- 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
- 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.
- Check whether a plugin update fixes it; warnings after a PHP upgrade usually have one.
- 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.
- On a live site keep warnings out of visitors' view: set
WP_DEBUG_DISPLAYto false (the wp-config debug settings generator writes the lines).
Details
| Code | Severity | Group |
|---|---|---|
| PB-2202 | Warning | PHP |
