Modify

Opened 7 months ago

Last modified 6 weeks ago

#3976 assigned Bug

StringRegExp can create invalid arrays (just like StringSplit)

Reported by: jchd18 Owned by: Jon
Milestone: Component: AutoIt
Version: 3.3.16.1 Severity: None
Keywords: Cc:

Description (last modified by mLipok)

The issue raised by ticket #3972 applies as well to StringRegExp, for the very same reason.

Global $s = ' '
For $i = 0 To 24 Step 1
        $s = $s & ";" & $s
Next
ConsoleWrite(StringLen($s) & @CRLF)
; String is now 33,554,432 symbols long with 33,554,431 delimiters

Global $a = StringRegExp($s, '(.[^;]*);?', 3) ; Also works with flag 4.
Global $err = @error, $ext = @extended
ConsoleWrite('@error = ' & $err & @CRLF) ; @error is not set, because delimiters were indeed found
ConsoleWrite('@extended = ' & $ext & @CRLF) ; Just to be sure it is also 0.
ConsoleWrite('VarGetType = ' & VarGetType($a) & @CRLF) ; It is an array
ConsoleWrite('UBound = ' & UBound($a) & @CRLF) ; UBound works (propably because Array-Metadata are set before the array is filled, I don't know the code so this is guesswork)
ConsoleWrite($a[0] & @CRLF) ; This will fail -> Array variable has incorrect number of subscripts

Attachments (0)

Change History (2)

comment:1 Changed 7 months ago by mLipok

  • Description modified (diff)

comment:2 Changed 6 weeks ago by Jpm

  • Owner set to Jon
  • Status changed from new to assigned

Fix sent to Jon

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 assigned The owner will remain Jon.
Author


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

 
Note: See TracTickets for help on using tickets.