[Bugfix] Multiple calls of editableFeatures method breaks php #5479
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When a popup is displayed the system checks first whether the user can edit the feature or not, so as to configure the
lizmap-feature-toolbar
HTML element correctly.At time being, if the layer is
filtered by user
(Attribute filtering
tab in Lizmap plugin), the system queries all the features of the layers and then filters the entire list by feature id to perform the check.lizmap-web-client/lizmap/modules/lizmap/lib/Request/WMSRequest.php
Line 785 in 25ba42b
This operation is executed for every feature on popup, even if features belonging to same layer.
If the layer has a lot of feature then this operation easily leads to php exceptions (
max_execution_time
on master branch withjsonmachine
, memory error for Lizmap <= 3.8 )I didn't use the
isFeatureEditable
method (which seems suitable for this job) because it requires afeature
object that you can't get from a WMS request (like thePopup
request) so, as a first solution, I chose to parameterize theeditableFeatures
function.Backport to 3.8 and 3.9, if possible
Funded by Faunalia