Modify

Opened 15 years ago

Closed 15 years ago

#1353 closed Bug (Fixed)

_FileWriteToLine() excessively strict on input text type

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

Description

Reported by user anixon: http://www.autoitscript.com/forum/index.php?showtopic=107078

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)
    EndIf
    
    ; ...
    
EndFunc

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 15 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 15 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 15 years ago by Jon

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

Fixed by revision [5566] in version: 3.3.3.3

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 Jon.
Author


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

 
Note: See TracTickets for help on using tickets.