Modify

Opened 12 years ago

Closed 12 years ago

Last modified 11 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 Changed 12 years ago by water

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

comment:2 Changed 12 years ago by johnmcloud

I can confirm the bug, the solution work fine

comment:3 Changed 12 years ago by guinness

  • Milestone set to 3.3.9.1
  • Owner set to guinness
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [6784] in version: 3.3.9.1

comment:4 Changed 11 years ago by anonymous

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 Changed 11 years ago by MrCreatoR

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 Changed 11 years ago by Jpm

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

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain guinness.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.