
You moved the site to PHP 8 and new messages appear. Nearly all come from the same place: PHP 8 became less tolerant of careless code. What used to be a discreet notice, or passed in silence, is now a visible warning or an error that stops the page. The code behind them is usually a plugin’s, a theme’s or an old library’s, and the cure is to update it. This is the list of the messages seen most, what they mean and how to handle them. The version numbers come from PHP’s public documentation.
The messages, one by one
| The message | Since | It means | What to do |
| Warning: Undefined array key "x" | 8.0 | The code reads a position in a list that does not exist (in PHP 7 it was “Undefined index”, a quieter notice). | Whoever codes checks first (isset or ??). A plugin: update it. |
| Warning: Undefined variable $x | 8.0 | A variable is used that was never defined. | The same. It is carelessness in the code, rarely serious. |
| Uncaught TypeError: Unsupported operand types: string * int | 8.0 | A calculation was done with an empty or non-numeric text. | Convert or validate the value before the calculation. It stops the page. |
| TypeError: count(): Argument #1 must be of type Countable|array, null given | 8.0 | Something that does not exist was counted. | Make sure it is a list before counting. |
| Deprecated: Passing null to parameter #1 ($string) of type string is deprecated | 8.1 | A null value was passed to a function that asks for text. | Use an empty text in its place. It does not stop the page. |
| Deprecated: Return type of ... should either be compatible with ... ReturnTypeWillChange | 8.1 | An old class does not declare the type PHP now expects. | Update the library. It does not stop the page. |
| Deprecated: Creation of dynamic property Class::$x is deprecated | 8.2 | The code creates a property on an object without declaring it in the class. | Declare the property in the class. It does not stop the page. |
Step by step
|
|
|
|
|
| Hiding warnings does not fix them. Silencing the messages on screen is reasonable on a public site, but the warning is a sign that the code may fail in other cases. See PHP warnings showing on your site: what they are and how to silence them. “Deprecated” notices may not even reach the log, because the stock configuration does not record them. |
| An old PHP is a debt. Going back solves today, but leaves the site on a version that stops receiving security fixes. Use the time you gained to update. See which PHP version to use. |
|
A PHP 8 message you cannot tie to a plugin or a line? Send us the full message and the page address. Open a support ticket |
|
SEE ALSO Which PHP version should your site use Changing your PHP version without breaking the site PHP warnings showing on your site: what they are and how to silence them |
RECOMMENDED PRODUCT Web hosting with cPanel Domain and SSL included, daily backups and the panel you already know. from $6.59/mo (3-year plan, with coupon) See plans |
- 0 Users Found This Useful











