Modify

Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#2125 closed Bug (Fixed)

_FileWriteFromArray crashes when writing a 2D array

Reported by: water Owned by: guinness
Milestone: 3.3.9.1 Component: Standard UDFs
Version: 3.3.8.0 Severity: None
Keywords: _FileWriteFromArray Cc:

Description

When writing a 2D array the script crashes with error message:
Array variable has incorrect number of subscripts or subscript dimension range exceeded.

Reproducer Script:

#include <file.au3>
#include <array.au3>
Global $aTest[2][2] = 1,2],[2,3
_ArrayDisplay($aTest)
_FileWriteFromArray("C:\temp\test.log", $aTest)

The array is displayed correctly as a 2D array. But then the script crashes with:
C:\Program Files (x86)\AutoIt3\Include\file.au3 (272) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
$s_Temp &= $s_Delim & $a_Array[$x][$y]
$s_Temp &= $s_Delim & ERROR

Solution:
Replace line 271: For $y = 1 To $iDims
with
For $y = 0 To $iDims-1

Attachments (0)

Change History (6)

comment:1 by water, 14 years ago

Sorry, the correct solution would be: "For $y = 1 To $iDims-1"

comment:2 by johnmcloud, 14 years ago

I can confirm the bug, the solution work fine

comment:3 by guinness, 14 years ago

Milestone: 3.3.9.1
Owner: set to guinness
Resolution: Fixed
Status: newclosed

Fixed by revision [6784] in version: 3.3.9.1

comment:4 by anonymous, 13 years ago

It should be:

For $y = 0 To Ubound($a_Array)-1

otherwise not all elements of second dimension are written to the file.

comment:5 by MrCreatoR, 13 years ago

actually this fix is more correct, because there is $s_Temp = $a_Array[$x][0]...

For $y = 1 To Ubound($a_Array)-1

comment:6 by J-Paul Mesnage, 13 years ago

Please don't add info as it is already fixed in Beta

Modify Ticket

Action
as closed The owner will remain guinness.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.