3liz / lizmap-web-client

Transfer a QGIS project on a server, Lizmap is providing the web interface to browse it
https://www.lizmap.com
Mozilla Public License 2.0
252 stars 141 forks source link

[Bug]: Wrong group ID in the CFG leads to a PHP error when loading the project #3171

Closed Gustry closed 1 year ago

Gustry commented 2 years ago

What is the bug?

The project is not available in the group ID doesn't not exist :

An error occurred while loading this map. Some necessary resource may temporarily be unavailable. Please try again later.

In the PHP logs :

2022-08-21 14:26:39 172.23.0.1  error   [0] property_exists(): Argument #1 ($object_or_class) must be of type object|string, array given
  /srv/lzm/lizmap/modules/lizmap/lib/Project/Project.php    1780
 /index.php/lizmap/service/getProjectConfig?repository=testsrepository&project=filter_layer_by_user
 array (   'repository' => 'testsrepository',   'project' => 'filter_layer_by_user',   'module' => 'lizmap',   'action' => 'service:getProjectConfig', )
 ref:http://lizmap.local:8130/index.php/view/map?repository=testsrepository&project=filter_layer_by_user

    0   property_exists()   /srv/lzm/lizmap/modules/lizmap/lib/Project/Project.php : 1780
    1   Lizmap\Project\Project->getUpdatedConfig()  /srv/lzm/lizmap/modules/lizmap/controllers/service.classic.php : 751
    2   serviceCtrl->getProjectConfig() /srv/lzm/lizmap/vendor/jelix/jelix/lib/jelix/core/jCoordinator.class.php : 266
    3   jCoordinator->process() /srv/lzm/lizmap/www/index.php : 23

2022-08-21 14:27:03 172.23.0.1  deprecated  [8192]  trim(): Passing null to parameter #1 ($string) of type string is deprecated
  /srv/lzm/lizmap/vendor/jelix/jelix/lib/jelix-admin-modules/jauthdb_admin/controllers/default.classic.php  132
 /admin.php/users-admin
 array (   'module' => 'jauthdb_admin', )
 ref:http://lizmap.local:8130/admin.php/auth/account/show?user=admin

    0   trim()  /srv/lzm/lizmap/vendor/jelix/jelix/lib/jelix-admin-modules/jauthdb_admin/controllers/default.classic.php : 132
    1   defaultCtrl->index()    /srv/lzm/lizmap/vendor/jelix/jelix/lib/jelix/core/jCoordinator.class.php : 266
    2   jCoordinator->process() /srv/lzm/lizmap/www/admin.php : 23

2022-08-21 14:31:07 172.23.0.1  error   [0] property_exists(): Argument #1 ($object_or_class) must be of type object|string, array given
  /srv/lzm/lizmap/modules/lizmap/lib/Project/Project.php    1780
 /index.php/lizmap/service/getProjectConfig?repository=testsrepository&project=filter_layer_by_user
 array (   'repository' => 'testsrepository',   'project' => 'filter_layer_by_user',   'module' => 'lizmap',   'action' => 'service:getProjectConfig', )
 ref:http://lizmap.local:8130/index.php/view/map?repository=testsrepository&project=filter_layer_by_user

    0   property_exists()   /srv/lzm/lizmap/modules/lizmap/lib/Project/Project.php : 1780
    1   Lizmap\Project\Project->getUpdatedConfig()  /srv/lzm/lizmap/modules/lizmap/controllers/service.classic.php : 751
    2   serviceCtrl->getProjectConfig() /srv/lzm/lizmap/vendor/jelix/jelix/lib/jelix/core/jCoordinator.class.php : 266
    3   jCoordinator->process() /srv/lzm/lizmap/www/index.php : 23

Steps to reproduce the issue

  1. Add a group ID which does not exist in the CFG file : tab "Layers" -> "Group visibility" for a random layer
  2. Visit the project in LWC ksnip_20220821-151126

Versions

Versions :

Check Lizmap plugin

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

No response

Operating system

Ubuntu

Browsers

Firefox

Browsers version

All

Relevant log output

No response

Gustry commented 2 years ago

Hum ...

Even if the group exists, it's an error if the current connected user is not belonging to the existing group.