Page 1 of 1 1
Topic Options
#79731 - 2003-06-03 09:45 AM BUG: Ubound() reports incorrect value
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
First reported by Christophe here

The problem manifests in both 4.20 and 4.21.

In the following code the array size of the second index reported by Ubound() after the second Dir() is incorrect:
code:
; Start first dir enumeration.  On it's own this won't cause a problem
$f = Dir("*",0)

; If you dont't iterate through the enumeration you won't get the problem.
While @error = 0
$f = Dir(,0)
Loop

; Declare the array - both GLOBAL and DIM exhibit the same problem.
; Arrays with 1 or 3 dimensions do not exhibit the problem.
Global $array[10,99]

; Check the array size
"[1] Array ubound should be 99: " Ubound($array,2) ?

; Start second fir enumeration. This will cause the error.
; If you use index 1 you won't get the problem.
$f = Dir("*",0)

; Check the array size again - this will fail
"[2] Array ubound should be 99: " Ubound($array,2) ?

Interestingly,
  • If you use enumaration handle 0 with the first Dir() and handle 1 with the second you don't get the problem.
  • If you don't exhaust the first Dir() enumeration handle you don't get the problem.
  • If you have a single dimension array or one with 3 dimensions you don't get the problem.
  • The problem occurs whether the array is declared as local or global

Top
#79732 - 2003-06-04 03:35 PM Re: BUG: Ubound() reports incorrect value
Ruud van Velsen Moderator Offline
Developer
*****

Registered: 1999-05-06
Posts: 391
Loc: Amsterdam, The Netherlands
Thanks for the detailed report!

Something's amiss indeed. I'll investigate, and let you know what I find.

Kind regards,

Ruud

Top
#79733 - 2003-06-10 03:03 PM Re: BUG: Ubound() reports incorrect value
Ruud van Velsen Moderator Offline
Developer
*****

Registered: 1999-05-06
Posts: 391
Loc: Amsterdam, The Netherlands
Just to let you know that the cause of this problem has been found and fixed. The fix will be included in 4.22.

Thanks again for the report!

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 823 anonymous users online.
Newest Members
JimDunn, fgarcia, Viginette, ManuvdWielNL, Sir_Barrington
17890 Registered Users

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