Skip to content

[HttpFoundation] Deprecation error null not allowed InputBag::set() #37100

Closed
@krioo

Description

@krioo

Symfony version(s) affected: 5.1.0

Description
Calling InputBag::set()with the second argument set to null triggers deprecation error:

Since symfony/http-foundation 5.1: Passing "null" as a 2nd Argument to "Symfony\Component\HttpFoundation\InputBag::set()" is deprecated, pass a string or an array instead.

This behaviour causes issues when replacing JSON request body with the JSON decoded value as JSON supports null values.

How to reproduce

/** @var Symfony\Component\HttpFoundation\Request $request */
$request->request->set('key', null);

Possible Solution
Allow null values by adding is_null(), since the currently used is_scalar(null) returns false: https://www.php.net/manual/en/function.is-scalar.php

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions