lizmap-web-client icon indicating copy to clipboard operation
lizmap-web-client copied to clipboard

[Bug]: Filter widget displays unwanted NULL value when using “splitter” in form filtering

Open katagen opened this issue 3 months ago • 0 comments

What is the bug? (in English)

When configuring a form filter (uniquevalues type) with a splitter character (e.g. comma , or semicolon ;), Lizmap automatically adds a NULL (empty) entry in the list of possible values — even though there are no NULL or empty values in the source data.

This behavior occurs systematically as soon as a splitter is defined, regardless of the data content. If the splitter is removed, the NULL entry disappears, but Lizmap then lists all full combinations of multi-values instead of splitting them, which is not usable in practice.

This suggests an internal logic issue when Lizmap builds the list of unique values after splitting strings — likely because an empty token ('') is added to the list during the PHP explode() process.

The list of available filter values should only include real unique tokens from the field, excluding NULL or empty strings.

Steps to reproduce the issue

  1. In QGIS, create a GeoPackage layer with a text field containing multi-values separated by commas, for example:

agenda

2026,2027 2028,2029 avant futur

→ No NULL values, no empty strings, no trailing commas.

  1. Publish the layer in Lizmap 3.9.3 and configure a form filter:

"formFilterLayers": { "0": { "layerId": "my_layer_id", "title": "Agenda", "type": "uniquevalues", "field": "agenda", "format": "checkboxes", "splitter": "," } }

  1. Open the Lizmap map viewer, expand the “Agenda” filter list.

  2. Observe that an additional (NULL) (or empty) entry appears in the list, even though the field never contains any NULL or empty values.

  3. If you remove the splitter parameter, the (NULL) entry disappears, but then all combinations appear literally (e.g. 2026,2027).

Versions, safeguards, check summary etc

Versions :

  • Lizmap Web Client : 3.9.3 - commit 32bad131d https://github.com/3liz/lizmap-web-client/commit/32bad131d
  • Lizmap plugin : 4.5.4
  • QGIS Desktop : 3.40.10
  • QGIS Server : 3.40.11
  • Py-QGIS-Server : 1.9.6
  • QGIS Server plugin atlasprint : 3.4.3
  • QGIS Server plugin lizmap_server : 2.14.1
  • QGIS Server plugin wfsOutputExtension : 1.8.3

Check Lizmap plugin

  • [x] I have done the step just before in the Lizmap QGIS desktop plugin before opening this ticket. Otherwise, my ticket is not considered valid and might get closed.

Operating system

Ubuntu 20.04

Browsers

Firefox

Browsers version

LTR

Relevant log output

No error is logged in the Lizmap or QGIS Server logs.
Behavior seems internal to Lizmap’s PHP processing of filter values (likely during explode() or aggregation step in FormFilter.php).

katagen avatar Oct 16 '25 14:10 katagen