Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated
PHP 8.1+ warns when null is passed to a built-in function that expects a string/int.
Passing null to parameteris deprecated Meaning
Internal functions used to coerce null silently. PHP 8.1 deprecates it (and a future version will throw). The value is usually an optional input or missing database field.
Common causes
- Optional request field passed directly to string functions
- Nullable DB column
- Return value of a function that can be null
⚡ Quick fix
- Coalesce:
strlen($name ?? '') - Validate inputs early
- Fix the source of the null
Detailed fix by platform
PHP
- Search logs for "Passing null to parameter" to find every call site after upgrading
How to diagnose
- Function — Which function and parameter?
- Value — Why is it null?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Call to undefined function create_function() WordPress on PHP 8: Fatal error: Uncaught Error: Call to undefined function create_function() / each()
- config global deprecated npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
- DEP0005 DeprecationWarning: Buffer() is deprecated due to security and usability issues (DEP0005)
Most viewed in PHP
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 12 Oct 2026