“Implicitly marking parameter … as nullable is deprecated” in WordPress: what it means

By CompatNav · Published · Last reviewed · 4 min read

Short answer

It’s a deprecation notice from PHP 8.4 and later: a plugin or theme declares a parameter with a type and a default of null (DateTime $created = null) without saying the type allows null. The code keeps working. It’s one of the most common PHP 8.4 notices, because the old way was normal for years. The fix is one character for the developer (?DateTime), and it works back to PHP 7.1. Update the plugin, or send the message to its developer.

The message, exactly

An order-notes plugin accepts an optional date. On PHP 8.3 it runs without a message; on PHP 8.4 the notice appears:

wp-content/plugins/order-notes/order-notes.php

<?php
class Order_Note {
    public function __construct(string $text, DateTime $created = null) {
        echo $text, $created ? ' (dated)' : ' (no date)', "\n";
    }
}

new Order_Note('Gift wrap');

Output on PHP 8.3.35

Gift wrap (no date)

Output on PHP 8.4.26

Deprecated: Order_Note::__construct(): Implicitly marking parameter $created as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/wp-content/plugins/order-notes/order-notes.php on line 3
Gift wrap (no date)

The message names where to look: the class and method (Order_Note::__construct()) and the parameter ($created), then the file and line.

What “implicitly nullable” means

A parameter like DateTime $created says: give me a date. Adding = null quietly widened that to: a date, or nothing. php.net: “A parameter’s type is implicitly widened to accept null if the default value for it is null.” (php.net) PHP 8.4 still accepts it, but wants the “or nothing” written in the type itself.

Is it urgent?

No. The output above is the same on both versions; PHP 8.4 only adds the notice. Two things are worth knowing, though:

  • The notice appears when the file is loaded, not when the function runs: here the function is never called, and PHP 8.4 still reports it. A plugin with many such parameters can add many lines to your log on every page view.

wp-content/plugins/order-notes/order-notes.php

<?php
function order_note_export(array $notes, DateTime $since = null) {
    // never called on this page
}

echo 'Page loaded', "\n";

Output on PHP 8.3.35

Page loaded

Output on PHP 8.4.26

Deprecated: order_note_export(): Implicitly marking parameter $since as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/wp-content/plugins/order-notes/order-notes.php on line 2
Page loaded
  • It continues on PHP 8.5. PHP 8.4 gets security fixes until 31 December 2028 and PHP 8.5 until 31 December 2029 (php.net), so the plugin has time, but it should be fixed.

Who fixes it

  1. Find the plugin or theme: the folder after wp-content/plugins/ or wp-content/themes/ in the message.
  2. Update it (Dashboard → Updates): this is a quick fix for developers, and its developer may already have made it.
  3. Already on the latest version? Send one full line of the message to its developer.
  4. Keep notices off your pages in the meantime: the WordPress debug log shows how to log them instead of displaying them.

A check that reads code finds every one, while your site still runs PHP 8.3:

The other PHP 8.4 changes you’re likely to meet are in WordPress and PHP 8.4.

Key takeaways

  • It’s a deprecation notice from PHP 8.4 and later; the code keeps working.
  • The message names the function and the parameter: Order_Note::__construct(): Implicitly marking parameter $created ….
  • The fix is to write the type as nullable: ?DateTime $created = null. It works on PHP 7.1 and later, so it doesn’t drop support for older sites.
  • It shows up when the file loads, even if the function is never called, so one plugin can fill a log quickly.
  • A check that reads code finds every one before you upgrade.

Frequently asked questions

Is it dangerous?

No. It’s a notice: the plugin works exactly as before. It’s a reminder that a future PHP version is expected to remove the old way of writing it.

Why do I see so many of them?

Because the old way of writing a parameter was common for years, a single plugin can have dozens, and each one gives its own notice when the file loads.

How do I keep them off my pages?

Log notices instead of displaying them: WP_DEBUG_DISPLAY off and a log file, as shown in our guide to the WordPress debug log. Hiding them doesn’t fix them; updating the plugin does.

Check your own site before you upgrade

CompatNav is a free WordPress plugin. It reads the code of your plugins and themes on your own server and tells you, in plain words, what will break and what will only show notices on the PHP version you choose. It never changes your code. It can’t see problems that only appear while code runs with real data, so a quick check of your site after the upgrade still matters.

Get CompatNav on wordpress.org How it works

Sources

About the code examples: each output is the real output of the code shown, run with the official PHP builds, without a php.ini, with all errors reported and displayed. Only the file path was replaced by a neutral server path.