# Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated

**Code:** `Deprecated null to internal` · **Category:** PHP · **Seen on:** PHP

PHP 8.1+ warns when null is passed to a built-in function that expects a string/int.

## 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

1. Coalesce: `strlen($name ?? '')`
2. Validate inputs early
3. Fix the source of the null

## Detailed fix by platform

### PHP

1. Search logs for "Passing null to parameter" to find every call site after upgrading

## How to diagnose

1. **Function** — Which function and parameter?
2. **Value** — Why is it null?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/php/deprecated-passing-null-to-parameter)
