#7098·dbal

Documentation about simple_array type suggests it can return null, an empty array is returned instead

Author: holtkampCreated Aug 21, 2025Updated Aug 16, 2026
LabelsBugTypesType Mapping

https://github.com/doctrine/dbal/blob/4.3.x/docs/en/reference/types.rst#simple_array https://github.com/doctrine/dbal/blob/4.4.x/docs/en/reference/types.rst#simple_array https://github.com/doctrine/dbal/blob/5.0.x/docs/en/reference/types.rst#simple_array

all end with:

Values retrieved from the database are always converted to PHP's array type using comma delimited explode() or null if no data is present.

The last sentence "or null if no data is present." seems not the way it is implemented: in case no data is present, an empty array is returned according to:

https://github.com/doctrine/dbal/blob/4.3.x/src/Types/SimpleArrayType.php#L43-L45

To me that seems incorrect. An empty array is a different value than NULL. NULL is no value. Why isn't NULL returned as the documentations states? And if the current implementation is the "agreed upon approach", then the documentation should be changed to indicate an array is always returned?