Issue 70380 - unexpected behaviour when using basic 'erase'
Summary: unexpected behaviour when using basic 'erase'
Alias: None
Product: General
Classification: Code
Component: scripting (show other issues)
Version: OOo 2.0.4
Hardware: All All
: P3 Trivial (vote)
Target Milestone: OOo 2.4
Assignee: sled10guy
QA Contact: issues@framework
Depends on:
Reported: 2006-10-13 07:54 UTC by noel.power
Modified: 2009-07-20 14:55 UTC (History)
2 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---

patch (2.25 KB, patch)
2006-10-13 07:55 UTC, noel.power
no flags Details | Diff
sortof test document (8.80 KB, application/vnd.oasis.opendocument.spreadsheet)
2006-10-13 07:57 UTC, noel.power
no flags Details
version #2 (3.90 KB, patch)
2006-10-13 18:10 UTC, noel.power
no flags Details | Diff
another version of test document (9.17 KB, application/vnd.sun.xml.calc)
2007-02-26 14:02 UTC, noel.power
no flags Details
self testing document (10.39 KB, application/vnd.sun.xml.calc)
2007-03-05 13:38 UTC, noel.power
no flags Details
final version of test document (10.88 KB, application/vnd.oasis.opendocument.spreadsheet)
2007-05-17 17:30 UTC, noel.power
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description noel.power 2006-10-13 07:54:46 UTC
so the proposed patch here is incomplete ( but should serve as a start point for
discussion etc. )
also there is I think another issue associated with this[*], we can discuss
whether it's necessary to raise another issue here or fix it with this patch

what's the story?
current behaviour seems to completely destroy the array you 'erase' and free all
memory. For vba interoperability obviously thats not the best ;-) the patch here
just clears the array ( but not the memory ) if the compatibility option is

Note: currently the patch make no distinction made between variant and fixed
array's ( but that should be easy to do? ) so this is a first step ;-) vba
behavior apparently is
    * if its a variant array ( behave like ooobasic does now )
    * if its a fixed array, set the values to appropriate initial ones

so, if compatability no matter what type of array it is it is 'zeroed' rather
than released
for non-compatibility mode of course the behavior is the same as always.

[*] even in "normal" mode after an erase it is possible to navigate the array
without "getting index out of bounds"
Comment 1 noel.power 2006-10-13 07:55:48 UTC
Created attachment 39715 [details]
Comment 2 noel.power 2006-10-13 07:57:34 UTC
Created attachment 39716 [details]
sortof test document
Comment 3 noel.power 2006-10-13 18:10:54 UTC
Created attachment 39740 [details]
version #2
Comment 4 noel.power 2006-10-13 18:12:28 UTC
ahem, it appears that basic itself uses erase as part of the pcode it generates,
so I had to put a quick hack for determining if an array is fixed size or not
hence the version-2 patch
Comment 5 ab 2006-10-18 09:35:21 UTC
Patch is incomplete -> 2.x for now, STARTED
Comment 6 kai.sommerfeld 2007-01-11 12:49:14 UTC
kso->np: This task is added to CWS npower5, which is targeted for OOo 2.2.
Unfortunately, npower5 has no due date. Is npower5 actually intended to be
integrated into 2.2? If yes, please set the target for this task to 2.2 (and
supply due dates for your CWS, please). If no, please adjust the target of the
CWS (and the tasks it contains).
Comment 7 noel.power 2007-01-16 09:34:17 UTC
lets try for 2.2
Comment 8 ab 2007-01-23 15:09:04 UTC
ab->npower: Assigning to you as all other npower5 
tasks are also assigned to you.
Comment 9 pavel 2007-01-24 11:35:48 UTC
Move to 2.3.
Comment 10 noel.power 2007-02-16 17:04:27 UTC
try for npower7
Comment 11 noel.power 2007-02-26 14:02:35 UTC
Created attachment 43378 [details]
another version of test document
Comment 12 noel.power 2007-03-05 13:38:58 UTC
Created attachment 43529 [details]
self testing document
Comment 13 noel.power 2007-05-05 13:11:55 UTC
Comment 14 noel.power 2007-05-17 17:30:16 UTC
Created attachment 45192 [details]
final version of test document
Comment 15 noel.power 2007-05-17 17:33:32 UTC
final version of the test document above, please use this one to test 

the legacy test has some failures, these failure should be identical when
running this document on any other version of openoffice ( e.g. any version that
doesn't include the fixes to this cws )

the vba test should pass.
Comment 16 noel.power 2007-07-11 12:47:49 UTC
for qa
Comment 17 noel.power 2007-08-07 10:11:07 UTC
change target
Comment 18 sled10guy 2007-08-28 16:18:42 UTC
Ran test documents (EraseArrayTest.ods) on released SLED10 SP1 OOo 2.1.14,
Windows OOo 2.1 (Build 2007-06-04) and cws-npower7-m217. Below are the results
returned in the msgbox after pressing the "legacy test" button:
• Test Results
• =============
• test 4 check modified contents of erased array failed got False expected True
• test 5 test illegal element variant array element failed got True expected False
• test 8 test use of ubounds on erase variant array failed got True expected False
• Tests passed: 5
• Tests failed: 3
‣ Below are the results returned in the msgbox after pressing the "vba compat
test" button:
• Test Results
• =============
• Tests passed: 8
• Tests failed: 0
‣ RESULT: Test Passed
Comment 19 thorsten.ziehm 2009-07-20 14:55:44 UTC
This issue is closed automatically and wasn't rechecked in a current version of
OOo. The fixed issue should be integrated in OOo since more than half a year. If
you think this issue isn't fixed in a current version (OOo 3.1), please reopen
it and change the field 'Target Milestone' accordingly.

If you want to download a current version of OOo =>
If you want to know more about the handling of fixed/verified issues =>