sonata-project / SonataAdminBundle

The missing Symfony Admin Generator
https://docs.sonata-project.org/projects/SonataAdminBundle
MIT License
2.1k stars 1.26k forks source link

Input value "filters" contains a non-scalar value. #8152

Open frankverhoeven opened 6 months ago

frankverhoeven commented 6 months ago

Environment

Sonata packages

show

``` $ composer show --latest 'sonata-project/*' Direct dependencies required in composer.json: sonata-project/admin-bundle 4.29.2 4.29.2 The missing Symfony A... sonata-project/doctrine-orm-admin-bundle 4.15.0 4.15.0 Integrate Doctrine OR... sonata-project/exporter 2.14.0 3.3.0 Lightweight Exporter ... sonata-project/form-extensions 1.20.0 2.3.0 Symfony form extensions sonata-project/twig-extensions 2.4.0 2.4.0 Sonata twig extensions Transitive dependencies not required in composer.json: sonata-project/block-bundle 5.1.0 5.1.0 Symfony SonataBlockBu... sonata-project/doctrine-extensions 2.3.0 2.3.0 Doctrine2 behavioral ```

Symfony packages

show

``` $ composer show --latest 'symfony/*' Direct dependencies required in composer.json: symfony/asset v6.4.0 v7.0.0 Manages URL generation an... symfony/browser-kit v6.4.0 v7.0.0 Simulates the behavior of... symfony/config v6.4.0 v7.0.0 Helps you find, load, com... symfony/console v6.4.2 v7.0.2 Eases the creation of bea... symfony/css-selector v6.4.0 v7.0.0 Converts CSS selectors to... symfony/debug-bundle v6.4.0 v7.0.0 Provides a tight integrat... symfony/dependency-injection v6.4.2 v7.0.2 Allows you to standardize... symfony/doctrine-bridge v6.4.2 v7.0.2 Provides integration for ... symfony/dotenv v6.4.2 v7.0.2 Registers environment var... symfony/error-handler v6.4.0 v7.0.0 Provides tools to manage ... symfony/event-dispatcher v6.4.2 v7.0.2 Provides tools that allow... symfony/expression-language v6.4.2 v7.0.2 Provides an engine that c... symfony/filesystem v6.4.0 v7.0.0 Provides basic utilities ... symfony/finder v6.4.0 v7.0.0 Finds files and directori... symfony/flex v2.4.3 v2.4.3 Composer plugin for Symfony symfony/form v6.4.1 v7.0.1 Allows to easily create, ... symfony/framework-bundle v6.4.2 v7.0.2 Provides a tight integrat... symfony/http-foundation v6.4.2 v7.0.0 Defines an object-oriente... symfony/http-kernel v6.4.2 v7.0.2 Provides a structured pro... symfony/mailer v6.4.2 v7.0.2 Helps sending emails symfony/mime v6.4.0 v7.0.0 Allows manipulating MIME ... symfony/monolog-bundle v3.10.0 v3.10.0 Symfony MonologBundle symfony/options-resolver v6.4.0 v7.0.0 Provides an improved repl... symfony/phpunit-bridge v6.4.2 v7.0.2 Provides utilities for PH... symfony/process v6.4.2 v7.0.2 Executes commands in sub-... symfony/property-access v6.4.0 v7.0.0 Provides functions to rea... symfony/proxy-manager-bridge v6.4.0 v6.4.0 Provides integration for ... symfony/psr-http-message-bridge v2.3.1 v7.0.2 PSR HTTP message bridge symfony/routing v6.4.2 v7.0.2 Maps an HTTP request to a... symfony/security-bundle v6.4.2 v7.0.2 Provides a tight integrat... symfony/serializer v6.4.2 v7.0.2 Handles serializing and d... symfony/stopwatch v6.4.0 v7.0.0 Provides a way to profile... symfony/translation v6.4.2 v7.0.2 Provides tools to interna... symfony/twig-bridge v6.4.2 v7.0.2 Provides integration for ... symfony/twig-bundle v6.4.0 v7.0.0 Provides a tight integrat... symfony/uid v6.4.0 v7.0.0 Provides an object-orient... symfony/validator v6.4.2 v7.0.2 Provides tools to validat... symfony/web-profiler-bundle v6.4.2 v7.0.2 Provides a development to... symfony/workflow v6.4.2 v7.0.2 Provides tools for managi... symfony/yaml v6.4.0 v7.0.0 Loads and dumps YAML files Transitive dependencies not required in composer.json: symfony/cache v6.4.2 v7.0.2 Provides extended PSR-6, ... symfony/cache-contracts v3.4.0 v3.4.0 Generic abstractions rela... symfony/clock v6.4.2 v7.0.2 Decouples applications fr... symfony/deprecation-contracts v3.4.0 v3.4.0 A generic function and co... symfony/dom-crawler v6.4.0 v7.0.0 Eases DOM navigation for ... symfony/event-dispatcher-contracts v3.4.0 v3.4.0 Generic abstractions rela... symfony/intl v6.4.2 v7.0.2 Provides access to the lo... symfony/monolog-bridge v6.4.0 v7.0.0 Provides integration for ... symfony/password-hasher v6.4.0 v7.0.0 Provides password hashing... symfony/polyfill-php83 v1.28.0 v1.28.0 Symfony polyfill backport... symfony/polyfill-uuid v1.28.0 v1.28.0 Symfony polyfill for uuid... symfony/property-info v6.4.0 v7.0.0 Extracts information abou... symfony/security-acl v3.3.3 v3.3.3 Symfony Security Componen... symfony/security-core v6.4.0 v7.0.1 Symfony Security Componen... symfony/security-csrf v6.4.0 v7.0.1 Symfony Security Componen... symfony/security-http v6.4.0 v7.0.1 Symfony Security Componen... symfony/service-contracts v3.4.1 v3.4.1 Generic abstractions rela... symfony/string v6.4.2 v7.0.2 Provides an object-orient... symfony/templating v6.4.0 v6.4.0 Provides all the tools ne... symfony/translation-contracts v3.4.1 v3.4.1 Generic abstractions rela... symfony/var-dumper v6.4.2 v7.0.2 Provides mechanisms for w... symfony/var-exporter v6.4.2 v7.0.2 Allows exporting any ser ```

PHP version

$ php -v
PHP 8.3.1 (cli) (built: Jan 11 2024 04:08:10) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.1, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.1, Copyright (c), by Zend Technologies

Subject

Since HttpFoundation ^6.0, InputBag::get() must return scalar values. A call to AbstractAdmin::getFilterParameters() may return an array.

The fix would be to change $this->getRequest()->query->get('filters') into $this->getRequest()->query->all('filters'), which may return an array.

VincentLanglet commented 6 months ago
$this->getRequest()->query->all('filters')

always look for array, which is not the case.

One solution would be $this->getRequest()->query->all()['filters'].

But I don't see why the filters would be an array.

We're using

$filters = $bag->all('filter');
if ('reset' === $this->getRequest()->query->get('filters')) {

Maybe you're misusing the param ?

github-actions[bot] commented 3 days ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

phansys commented 3 days ago

@frankverhoeven, could you please confirm if the issue is still present in your setup?