Fix automatic conversion of false to array in PHP
What the message means
Automatic conversion of false to array is deprecated appears when code appends an element to a value that is currently false. There was no array ready to receive the new data. In a WordPress plugin, an earlier function may have returned false.
The notice alone does not reveal whether that represents a failed lookup or an intentional starting value.
Before you change anything
Save the complete error line and its timestamp in a private note. Record the failed action, the active PHP version and any components updated at the same time. Do not post passwords, customer details or full server paths in a public support forum.
Back up both files and the database before making changes. Check that the backup can actually be restored. Use a protected test copy with the same PHP version and relevant settings, with real payments and outgoing customer emails disabled.
Agree who will make the change and who will check the result. Match the log entry to the action you perform on the website. An old background task can produce a message unrelated to the page you are looking at now.
Cause and related errors
PHP 8.1 deprecated automatically creating an array from false in this situation. The change specifically concerns false. Building an array from null or a previously undefined value is not deprecated by this same migration rule.
Start where false is assigned. An intentionally empty list can be initialized explicitly as an array. If false comes from a failed lookup, handle that failure before adding new entries.
Replacing every false result with an empty list could conceal a failed inventory request.
Five steps to repair
- Save the error line and identify the value receiving a new element. Record which visitor action is supposed to build the list.
- Trace where false originates. Distinguish an initial value from a missing result and a failed internal or external lookup.
- Agree the expected behavior for each situation. Explicitly initialize an intended empty list and handle an unsuccessful lookup separately.
- Test a populated list, a valid empty result and a failed lookup. Check that only the valid cases proceed to normal processing.
- Repeat the original action and inspect the saved list. Review fresh logs and confirm that a failure cannot become a successful empty operation.
A concrete acceptance test
Consider an import collecting product labels as an acceptance example. Process a valid file with labels, then a valid file without labels. On the test copy, also simulate a failed read without modifying real customer records.
That case should produce an identifiable failure outcome. A silent empty import is appropriate only when the source is genuinely valid and empty.
Updating WordPress or WooCommerce components
If the error points to a plugin or theme, first check whether its author documents a relevant update. Record the installed version before trying that update on the test copy. Include any custom extensions that depend on the component in your checks.
Avoid editing supplier files without an agreed maintenance plan. A later update can overwrite a manual repair. For custom code, ask for a change that is kept with the source code and can be tested again during the next PHP update.
When to ask for help
Use the existing PHP update service if you cannot trace the error or if it affects orders, payments or saved records. Describe the failed action and the expected result in the help form below. An error message alone does not identify which component needs to change.
Ask the maintainer to record the cause and proposed repair first. After the change, repeat the original action and inspect fresh log entries at the test timestamp. For a store, also inspect the saved test order without taking a real payment.
Check your PHP version
Use the Exposure Check link below this article to check your PHP version where it is publicly visible. If that information is unavailable, ask your host to confirm the active version. This check cannot read private logs and does not prove that the programming error is fixed.
Visit the PHP security status page for the separate assessment of your PHP version. Save the versions, code change and test outcome in your maintenance notes. Let the responsible maintainer decide when the tested repair should be applied to the live website.