Page 1 of 1 1
Topic Options
#153607 - 2005-12-16 09:57 PM Possible INSTR bug
pfarrelli Offline
Fresh Scripter

Registered: 2005-11-16
Posts: 46
If string1 the string to search IN is smaller than string2 the one to search for, INSTR returns nothing ... not ZERO .. nothing!! Is that supposed to be the case?

In the code below, the version returned by the file is 8.1.0.825 ($version) and is SHORTER than the sting looking into it .. thus returning NOTHING. You would think it would return 0.

----------------------------------


$versionstring = "10.0.2.2000"
$version10loc = "c:\Program Files\Symantec Antivirus\vpc32.exe"
$version7loc = "v:\vpc32.ex7"
$version8loc = "v:\vpc32.ex8"


$Version= getfileversion($version8loc)
at (3,1) "version looking for " $versionstring
at (4,1) "version is " $version

$offset = instr ($version , $versionstring)
at (5,1) "offset is " $offset
if $offset <> 0
at (6,1) "strings are the same"
else
at (6,1) "strings are different"
endif

-----------------------------------

Top
#153608 - 2005-12-16 10:06 PM Re: Possible INSTR bug
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Please see this post for further details.

http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=153120
 

Top
#153609 - 2005-12-16 10:28 PM Re: Possible INSTR bug
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
what's the vartype() of the return value?
might be a buggie in boolean to integer conversion routines.
_________________________
!

download KiXnet

Top
#153610 - 2005-12-20 03:28 AM Re: Possible INSTR bug
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
See the MinorVersion() and CompareVersions() UDFs if you want to compare version strings.
_________________________
There are two types of vessels, submarines and targets.

Top
#153611 - 2005-12-20 05:38 AM Re: Possible INSTR bug
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Jens, I think you're missing the point here. This is being reported as a bug in KiXtart - not a post as in "is there a work-around".
Top
#153612 - 2005-12-20 09:23 AM Re: Possible INSTR bug
Ruud van Velsen Moderator Offline
Developer
*****

Registered: 1999-05-06
Posts: 391
Loc: Amsterdam, The Netherlands
In short: good catch. This is a bug in the handling of mismatched parameters by InStr(). I have fixed this in the current build of 4.52.

Thanks for the good work!

Ruud

Top
Page 1 of 1 1


Moderator:  ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1046 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.074 seconds in which 0.045 seconds were spent on a total of 12 queries. Zlib compression enabled.