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.
Seen on:
PHP
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 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026