Opened 14 years ago

Closed 14 years ago

#1353 closed Bug (Fixed)

_FileWriteToLine() excessively strict on input text type

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


Reported by user anixon:

The input $sText parameter is currently tested with IsString() and fails with @error = 6 if False. That is way too strict for the AutoIt environment where you can generally pass integers, floats, HWNDs, etc. to FilelWriteLine() and other text based functions.

Recommend change the test to this:

Func _FileWriteToLine($sFile, $iLine, $sText, $fOverWrite = 0)
    If $iLine <= 0 Then Return SetError(4, 0, 0)
    If Not IsString($sText) Then 
        $sText = String($sText)
        If $sText = "" Then Return SetError(6, 0, 0)
    ; ...

Does conversion with String() but prevents a non-text value that returns "" from unexpectedly deleting the line if overwrite is True.

Attachments (0)

Change History (3)

comment:1 Changed 14 years ago by Jpm

Perhaps I am wrong but as this UDF was design to receive String it is the use responsability to pass string.
So for me there is no bug.

comment:2 Changed 14 years ago by Valik

There is no reason to force the data to be a string. If I want to write numbers to the file that's my business. There is no reason that behavior should not be supported.

comment:3 Changed 14 years ago by Jon

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

Fixed by revision [5566] in version:

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

as closed The owner will remain Jon.

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

Note: See TracTickets for help on using tickets.