You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 8, 2023. It is now read-only.
If the values of keyColumnName and parentColumnName fields are strings with only numeric character, the recursivity of normalizeData method in TreeGrid class is potentially endless.
Example case:
For example, if we have the follow data (informal code):
Node1: [key = "1", parentKey = null]
Node2: [key = "01", parentKey = "1"]
Node3: [key = "001", parentKey = "01"]
When is searching then Node2's children (value of $parentId parameter is "01"), because Node2's parentKey is "1", the condition ArrayHelper::getValue($element, $this->parentColumnName) == $parentId is evaluated true, therefore a new call to normalizeData is thrown to search (again) the Node2's children.
Suggested modification:
Use the type-strict comparation operator (===) instead the double equal operator (==).
The text was updated successfully, but these errors were encountered:
ovargas71
changed the title
The recursivity of normalizeData method does not work fine with numeric as string
The recursivity of normalizeData method is potentially endless with only-numbers string as key and parentKey
Oct 4, 2023
ovargas71
changed the title
The recursivity of normalizeData method is potentially endless with only-numbers string as key and parentKey
The recursivity of normalizeData method in TreeGrid class is potentially endless with only-numbers string as key and parentKey
Oct 5, 2023
The problem:
If the values of
keyColumnName
andparentColumnName
fields are strings with only numeric character, the recursivity ofnormalizeData
method in TreeGrid class is potentially endless.Example case:
For example, if we have the follow data (informal code):
When is searching then Node2's children (value of $parentId parameter is
"01"
), because Node2's parentKey is"1"
, the conditionArrayHelper::getValue($element, $this->parentColumnName) == $parentId
is evaluated true, therefore a new call tonormalizeData
is thrown to search (again) the Node2's children.Suggested modification:
Use the type-strict comparation operator (===) instead the double equal operator (==).
ArrayHelper::getValue($element, $this->parentColumnName) === $parentId
The text was updated successfully, but these errors were encountered: