Description: SF_Dictionary ReplaceItem does not accept array as input value. If you do then an exception will be thrown. In the code the switch for input value to check if is array is missing like we see it in "Add" Add: If IsArray(Item) Then If Not SF_Utils._ValidateArray(Item, "Item") Then GoTo Catch Else If Not SF_Utils._Validate(Item, "Item") Then GoTo Catch End If ReplaceItem: If Not SF_Utils._Validate(Value, "Value") Then GoTo Catch Where ADD-"Item" = ReplaceItem-"Value" Steps to Reproduce: 1. Dim myDict as Variant 2. myDict = CreateScriptService("Dictionary") 3. myDict.Add("key", Array()) 4. myDict.ReplaceItem("key", Array()) Actual Results: Exception with Text: Library : ScriptForge Service : Dictionary Method : ReplaceItem Arguments: Key, Value A serious error has been detected in your code on argument : « Value ». Validation rules : The actual value of « Value » is : '[ARRAY] ()' THE EXECUTION IS CANCELLED. Do you want to receive more information about the 'ReplaceItem' method ? Expected Results: No Errors Reproducible: Always User Profile Reset: No Additional Info: ReplaceItem Replaces an existing item value based on its key. Returns True if successful. Syntax: dict.ReplaceItem(key: str, value: any): bool Parameters: key: String value representing the key whose value will be replaced. Not case-sensitive. If the key does not exist in the dictionary, an UNKNOWNKEYERROR error is raised. value: The new value of the item referred to with the key parameter. Example: myDict.Add("a", 1) MsgBox(myDict.Item("a")) ' 1 myDict.ReplaceItem("a", 100) MsgBox(myDict.Item("a")) ' 100
I can confirm the issue using the latest master. @JPL what do you think? Can this be easily fixed?
I confirm the bug on master as well. mail@hagen-meyer.de suggests a fix in the description of the error. I implemented the suggestion as it was exactly what had to be done. See https://gerrit.libreoffice.org/c/core/+/144041 The patch will be pushed to master as soon as Jenkins agrees the change. JPL
Jean-Pierre Ledure committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/57e2245abf50cbd207d5c9c57ed67c055f8afcd6 SF_Dictionary: tdf#152351 Fix ReplaceItem does not accept array as value It will be available in 7.6.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Jean-Pierre Ledure committed a patch related to this issue. It has been pushed to "libreoffice-7-4": https://git.libreoffice.org/core/commit/50fde068eb702354e4b603231577c807b5e07d1a SF_Dictionary: tdf#152351 Fix ReplaceItem does not accept array as value It will be available in 7.4.4. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Jean-Pierre Ledure committed a patch related to this issue. It has been pushed to "libreoffice-7-5": https://git.libreoffice.org/core/commit/ce3b32f5d522042bd87535762e5e7002d1498cc8 SF_Dictionary: tdf#152351 Fix ReplaceItem does not accept array as value It will be available in 7.5.0.0.beta2. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.