#1551 closed Bug (Fixed)
Crash the script when changing array
Reported by: | Yashied | Owned by: | trancexx |
---|---|---|---|
Milestone: | 3.3.9.3 | Component: | AutoIt |
Version: | 3.3.6.0 | Severity: | None |
Keywords: | Cc: |
Description
AutoIt crashes the script instead indicate an error ("Subscript used with non-Array variable.") in the following code.
Global $aArray[1] $aArray[0] = _MyFunc('Test') Func _MyFunc($sStr) ; Local $aArray $aArray = $sStr Return $aArray EndFunc ;==>_MyFunc
Attachments (0)
Change History (7)
comment:1 Changed 15 years ago by MrCreatoR <mscreator@…>
comment:2 Changed 15 years ago by MrCreatoR <mscreator@…>
One more update...
Here is the quickest example that reproduces this crash:
Dim $Arr[1] $Arr[0] = Assign("Arr", "") ;Replace here "" with 0, and the script is not crashed o_O
comment:3 Changed 14 years ago by Jpm
- Owner set to Jon
- Status changed from new to assigned
comment:4 Changed 13 years ago by trancexx
- Milestone set to 3.3.9.3
- Owner changed from Jon to trancexx
- Resolution set to Fixed
- Status changed from assigned to closed
Fixed by revision [6886] in version: 3.3.9.3
comment:5 Changed 13 years ago by BrewManNH
If I run this code using AutoIt 3.3.9.5 I am still getting an error message
Dim $Arr[1] $Arr[0] = Assign("Arr", "") ;Replace here "" with 0, and the script is not crashed o_O
Running:(3.3.9.5):F:\PortableAutoIt3.3.8\App\beta\autoit3_x64.exe "\test.au3"
"\test.au3" (16) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
$Arr[0] = Assign("Arr", "")
ERROR
I've tried it with both the x86 and x64 versions, same error message.
If I run this code, I don't get an error message, but the Global $Arr has been turned into a simple variable and not an array.
Dim $Arr[1] $Arr[0] = _Test('Test') ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Arr = ' & $Arr & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console Func _Test($vVar) $Arr = $vVar Return $Arr EndFunc
comment:6 Changed 13 years ago by anonymous
Update, the second code runs in 3.3.8.0, but not in 3.3.9.5, that still gives me the same error message.
comment:7 Changed 13 years ago by Valik
Previously it crashed, now it gives a user-friendly error. An error message is the correct behavior. The code is stupid. Write better code.
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.
Confirmed, few tests on several autoit versions:
AutoIt:(see above) (Os:WIN_XP/X86/Service Pack 3 Language:0419 Keyboard:00000409 Cpu:X64)