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

[Bug]: Editing data of Array type with PHP 8.1 doesn't (always) work

Open geographit opened this issue 3 years ago • 1 comments
trafficstars

What is the bug?

When a project has an editable layer with

  1. An array field in Postgis
  2. A "customised" Attribute forms (E.g aliases...)

Trying to edit the layer in Lizmap throws an error in the logs array_key_exists(): Argument #2 ($array) must be of type array

It is not possible to edit the layer and Lizmap becomes unstable (I noticed some crashes).

Steps to reproduce the issue

  1. Create a postgis table with an array
CREATE TABLE test_array (
	id SERIAL NOT NULL PRIMARY KEY,
	my_array real [5] DEFAULT NULL,
 	geom geometry(MULTIPOLYGON, 4326)
	);
  1. Create a lizmap project with the layer set as editable

  2. Style the layer attribute form (add an alias). This will cause the .qgs file to specify the field type in xml <editWidget type="List">

  3. In lizmap edit the layer. It should hang and display an error in Lizmap logs.

Temporary fix

Installing php 7.8 instead of php 8.1 solves the issue. Also if the layer's attribute form is not modified, the project file (*.qgs) it seems php won't know the data type and there will be no error.

Versions

QGIS desktop 3.26 Lizmap 3.55 QGIS Server 3.26

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.

QGIS server version, only if the section above doesn't mention the QGIS Server version

No response

Operating system

Ubuntu 22 lts

Browsers

Firefox, Chrome, Safari, Microsoft Edge

Browsers version

Firefox 89

Relevant log output

No response

geographit avatar Aug 09 '22 00:08 geographit

thanks for the detailled steps, it's related to a change in array_key_exists since php 8.0. quick fix can be made

nworr avatar Aug 09 '22 13:08 nworr