Modify

Opened 15 years ago

Closed 15 years ago

#1620 closed Bug (Fixed)

debug.au3: single(') quote problem.

Reported by: anonymous Owned by: Jpm
Milestone: 3.3.7.0 Component: Standard UDFs
Version: 3.3.6.1 Severity: None
Keywords: debug.au3 quotes Cc:

Description

file: debug.au3
function: __Debug_ReportWrite()

Problem: The $sData contend is not checked/adjusted for the precents of single(') quote-marks.
Needed to prevent the used function inside the Execute() function from failing on data strings that contain single quote marks.

input: $__gsReportCallBack_Debug = "ConsoleWrite("
input: $sData = " ' ' "
code: Execute($__gsReportCallBack_Debug & "'" & $sData & "')")
result: Execute(...) -> ConsoleWrite(' ' ' ') -> fails.

--- rest ---

Posible fix: (preceding Execute() line)

	If StringInStr($sData, "'") Then $sData = StringReplace($sData, "'", "''")
	;; or just
	$sData = StringReplace($sData, "'", "''")

Test code:

#include 'Debug.au3'
Enum $_logwin_ = 1, $_console_, $_msgbox_, $_file_
_DebugSetup(Default, False, $_console_, 'DebugOut.log')

$sTest = " '' " ;; returns " ' " as output.
_DebugReportVar('1) $sTest', $sTest)
_DebugOut('2) $sTest = ' & $sTest)
$sTest = " ' ' " ;; returns nothing, function inside execute() failed.
_DebugReportVar('3) $sTest', $sTest)
_DebugOut('4) $sTest = ' & $sTest)

Change History (1)

comment:1 Changed 15 years ago by Jpm

  • Milestone set to 3.3.7.0
  • Owner changed from Gary to Jpm
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [5817] in version: 3.3.7.0

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

Author


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

 
Note: See TracTickets for help on using tickets.