#1 2024-05-28 06:17:51

sakura
Member
From: Germany
Registered: 2018-02-21
Posts: 235
Website

VariantToText-Bug

Hi arnaud,

VariantToText shall, according to doc, return false, if the variant ist empty or null false, otherwise it shall return true.
Following snippet returns false, though.

uses mormot.core.text;
var
  T: UTF8String;
begin
  Writeln(VariantToText(true, T));
  Writeln(T);
end.

In TRttiProp.SetValue this leads to not assigning a true-boolean value to a property.

Regards,
Daniel

Offline

#2 2024-05-28 07:46:03

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,492
Website

Re: VariantToText-Bug

It is a wrapper around VariantToUtf8() so

// - returns TRUE if the V value was a text, FALSE if was not (e.g. a number)

But of course, this is not what was documented, and what you expected.

Please try
https://github.com/synopse/mORMot2/commit/4f9a97ef

Offline

#3 2024-05-28 10:40:29

sakura
Member
From: Germany
Registered: 2018-02-21
Posts: 235
Website

Re: VariantToText-Bug

Thanks :-)

Offline

Board footer

Powered by FluxBB