Website Without PHP
English (United Kingdom)GB
  • English (United States)
  • English (United Kingdom)
  • Dutch (Netherlands)
  • Dutch (Belgium)
Menu

Required parameter follows optional after a PHP upgrade

DeprecatedA deprecation is an early warning that a feature still works today but will be removed in a future PHP version, so code using it must be changed in time.: Required parameter follows optional points to an awkward function definition: a required argument follows a parameter with a default value.

Which PHP version does your site report?

We read only what your site already sends in public: the headers and the top of the homepage. No scan, no login.

Get help with your website

More about this

Have the whole function and its callers reviewed.

Simply reversing the order can change the meaning of existing calls.

You do not need to rewrite code yourself to give your developer the right investigation question.

Error

Before you start

Save the complete error line and its timestamp in a private note. Record the action that failed, the current PHP versionA PHP version is a numbered edition of PHP, like 8.3. Each edition is looked after for a limited time, then gets security fixes only, then nothing. and any components updated at the same time. Share only information needed for the investigation.

Public support forums are not suitable places for customer details, access credentials or complete server paths.

Back up both files and the database before making changes. Check that the backupA backup is a separate copy of your website's files and database, so you can bring the site back after a mistake, a hack or a failed update. is usable. Work on a restricted test copy with the same PHP version and relevant settings.

Disable real payments and outgoing customer emails there. Agree who will make the change and who will check the result. These steps are an investigation guide, not a diagnosis of your particular website.

What is wrong with the contract? The PHPPHP is a programming language that builds your web pages on the computer that hosts your site, just before they reach the visitor. WordPress runs on it. 8.0 migration manual deprecates a parameter with a default value preceding a required parameter. Often the ineffective default can be removed.

The documentation also discusses the distinct case where a typed parameter with a null default is implicitly nullable. Have the exact declaration and PHP version reviewed before replacing a pattern throughout the code.

A parameter describes information a function receives; an argument is the actual value supplied in a call. For your repair request, the key question is which information is mandatory and which may genuinely be absent. Write that down in ordinary language.

The developer can then assess whether the code still matches its intended use.

Five steps to a repair

  1. Save the complete deprecation message with the function name and file location. Record the PHP version and affected component version too. Explain whether the website continues working or another error follows. Treat a subsequent error as separate evidence requiring investigation.
  2. Identify the maintainer. For a pluginA WordPress plugin is an add-on you install in WordPress to give your site extra features, such as contact forms, SEO tools or a webshop. or themeA WordPress theme is a ready-made package that decides how your WordPress site looks and how its pages are laid out. Change the theme and the design changes., check whether a suitable newer version is available. For custom code, request the original contract. Avoid an isolated edit without an overview of the places where the function is used.
  3. Collect the relevant calls. Ask which arguments are passed by position and which by name. Check whether other components rely on the same function. A change to the parameter list needs review alongside those dependencies.
  4. Test the proposed correction with complete input and every permitted omission. Record which value belongs to which parameter in each case. Check invalid input as well. The change should clarify the intended contract while preserving existing correct results.
  5. Repeat the main user action and inspect the new log. Check that information reaches the correct fields. Keep the chosen function contract and test cases with the maintenance record. A future developer should be able to understand why the default value or declaration changed.

Why moving parameters is not automatically safe

Imagine a function receiving two pieces of information in order: a description and a required number. Moving the parameters while leaving an existing call unchanged can alter what that call means. Request an overview of every affected call for this reason.

This example explains the check rather than prescribing code for your particular function.

Also establish whether the supposedly optional information was always needed in practice. An explicitly required parameter may better match existing use. Alternatively, the product may need a genuinely optional choice.

That is a behaviour decision to make before changing the code. For each test, record what the visitor enters and which information is saved.

A deprecation message warrants a maintenance action even if you can still continue through the website. Ask for a concrete correction and a time to review it on the test copy. Treat visitor-facing error display and private logging separately; hiding a message does not change the function contract.

At acceptance, therefore, check both application behaviour and fresh log entries.

Getting help and checking the repair

Use the help form below if you cannot access the logs or do not know who maintains the affected code. Describe one failed action and the expected result. Ask for a proposal that separates the cause, the change and the acceptance check.

Do not include passwords with your request.

After the repair, repeat the original action on the test copy. Also check a normal visitor journey, an empty result and invalid input where relevant. Review fresh log entries at the new test time.

Keep versions and outcomes in your maintenance notes. Let the responsible administrator decide when the tested change can be applied to the live website.

Frequently asked questions

Can I simply swap the two parameters?

Review every caller first. Position can carry meaning in existing code. Choose a correction based on the intended behaviour and test the affected combination.

Can the mini-check prove this cause?

No. A public check does not replace investigation of private logs and server settings. Use the error message and failing action as the starting point.

When is the repair complete?

When the original action produces the correct result and fresh logs show no recurrence. Keep the versions and test result in your maintenance notes.

Sources

Accessed on 22 October 2026.

  1. Domain
  2. Check
  3. Result
  4. Report

Which PHP version does your site run?

Enter your domain. We read only what your site already sends in public: the headers and the top of the homepage. No scan, no login.

We keep the domain and the result, never your IP address.