[Gambas-user] Issue 394 in gambas: JSON.Encode cannot encode an Array, includes FIX

gambas at ...2524... gambas at ...2524...
Sat Jan 26 11:17:08 CET 2013


Status: New
Owner: ----
Labels: Version Type-Bug Priority-Medium OpSys-Any Dist-Any Arch-Any  
Desktop-Any GUI-Any

New issue 394 by r... at ...1740...: JSON.Encode cannot encode an Array,  
includes FIX
http://code.google.com/p/gambas/issues/detail?id=394

1) Describe the problem.

When JSON.Encode is called with an array as argument, it errors with 'Not  
an Array in JSON:220'
Although it's a valid array.

2) GIVE THE FOLLOWING INFORMATIONS (if they are appropriate):

Version: TRUNK
Revision: r5516
Operating system: Linux
Distribution: Ubuntu 11.04
Architecture: x86_64
GUI component: QT4
Desktop used: Gnome

[System]
OperatingSystem=Linux
Kernel=2.6.38-16-generic
Architecture=x86_64
Distribution=Ubuntu 11.04
Desktop=GNOME
Theme=QGtk
Language=en_US.UTF-8
Memory=7739M

[Libraries]
GStreamer=libgstreamer-0.10.so.0.28.0
GTK+=libgtk-x11-2.0.so.0.2400.4
Poppler=libpoppler.so.13.0.0
Qt4=libQtCore.so.4.7.2
SDL=libSDL-1.2.so.0.11.3

3) Provide a little project that reproduces the bug or the crash.

5) Explain clearly how to reproduce the bug or the crash.

FIX:
Private Sub WriteValue(vVal As Variant)
...
     Case Else
       If vVal Is Array Then
         aArray = vVal
         $sStr &= "["
         For iPos = 0 To vVal.Max
           If iPos Then $sStr &= ", "
           WriteValue(vVal[iPos])   <--------------------
         Next
         $sStr &= "]"

Was WriteValues(aArray[iPos])

Dim aArray
and aArray = vVal
can be removed from that function too.

Haven't tested it in all situations.

6) By doing that carefully, you have done 100% of the bug fix job!








More information about the User mailing list