View Issue Details

IDProjectCategoryView StatusLast Update
0038580FPCRTLpublic2021-03-19 12:42
ReporterOndrej Pokorny Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Fixed in Version3.3.1 
Summary0038580: Delphi incompatibility in StartsStr and EndsStr for ASubStr=''
DescriptionThere is a Delphi incompatibility in StartsStr and EndsStr for ASubText=''
Steps To Reproduce  Writeln(BoolToStr(StrUtils.StartsStr('', 'x'), True)); // FPC: False; Delphi 10.4.2: True
  Writeln(BoolToStr(StrUtils.StartsStr('', ''), True)); // FPC: False; Delphi 10.4.2: True
  Writeln(BoolToStr(StrUtils.EndsStr('', 'x'), True)); // FPC: False; Delphi 10.4.2: True
  Writeln(BoolToStr(StrUtils.EndsStr('', ''), True)); // FPC: True ; Delphi 10.4.2: True
Additional InformationDelphi's behavior (=always return True for an empty ASubText) makes more sense for me.
TagsNo tags attached.
Fixed in Revision48898
FPCOldBugId
FPCTarget3.2.2
Attached Files

Activities

ravi dion

2021-03-04 21:08

reporter   ~0129384

Delphi 10.3 also returns true for all four. Program for testsuite attached

program test_38580;
{$IFDEF FPC}
  {$MODE Delphi}
{$ENDIF}
uses
  SysUtils, StrUtils;

begin
  if StrUtils.StartsStr('', 'x') <> true then halt(1);
  if StrUtils.StartsStr('', '') <> true then halt(2);
  if StrUtils.EndsStr('', 'x') <> true then halt(3);
  if StrUtils.EndsStr('', '') <> true then halt(4);
end.

Bart Broersma

2021-03-04 21:42

reporter   ~0129385

@Ondrej: you know that BoolToStr() is suerfluous here (sorry, could not resist)?

Ondrej Pokorny

2021-03-05 05:25

developer   ~0129388

@Bart: useless question. Obviously I didn't, otherwise I would have not used it, would I?

Michael Van Canneyt

2021-03-07 19:58

administrator   ~0129493

Fixed.

Bart Broersma

2021-03-07 22:21

reporter   ~0129499

Since this is a bugfix, can it be merged to 3.2 fixes?

Marco van de Voort

2021-03-19 10:41

manager   ~0129758

(fyi: Has been merged and will be in 3.2.2 but not in 3.2.2-rc1)

Ondrej Pokorny

2021-03-19 12:42

developer   ~0129759

Thank you!

Issue History

Date Modified Username Field Change
2021-03-04 10:06 Ondrej Pokorny New Issue
2021-03-04 21:08 ravi dion Note Added: 0129384
2021-03-04 21:42 Bart Broersma Note Added: 0129385
2021-03-05 05:25 Ondrej Pokorny Note Added: 0129388
2021-03-07 19:25 Michael Van Canneyt Assigned To => Michael Van Canneyt
2021-03-07 19:25 Michael Van Canneyt Status new => assigned
2021-03-07 19:58 Michael Van Canneyt Status assigned => resolved
2021-03-07 19:58 Michael Van Canneyt Resolution open => fixed
2021-03-07 19:58 Michael Van Canneyt Fixed in Version => 3.3.1
2021-03-07 19:58 Michael Van Canneyt Fixed in Revision => 48898
2021-03-07 19:58 Michael Van Canneyt FPCTarget => 4.0.0
2021-03-07 19:58 Michael Van Canneyt Note Added: 0129493
2021-03-07 22:21 Bart Broersma Note Added: 0129499
2021-03-19 10:41 Marco van de Voort Note Added: 0129758
2021-03-19 12:42 Ondrej Pokorny Status resolved => closed
2021-03-19 12:42 Ondrej Pokorny FPCTarget 4.0.0 => 3.2.2
2021-03-19 12:42 Ondrej Pokorny Note Added: 0129759