ID:               33285
 Updated by:       [EMAIL PROTECTED]
 Reported By:      andrewz at springsrescuemission dot org
-Status:           Verified
+Status:           Feedback
 Bug Type:         dBase related
 Operating System: *
 PHP Version:      5CVS-2005-06-20
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi




Previous Comments:
------------------------------------------------------------------------

[2005-06-20 17:43:52] andrewz at springsrescuemission dot org

Take for example the first entry in the header:

  [0] => Array
        (
            [name] => AREA
            [type] => unknown
            [length] => 1300
            [precision] => 0
            [format] => ´       "@
            [offset] => 1
        )

The type should be a double, the length 20, and the precision 5. 
Instead I get unknown, 1300, and 0.

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

[2005-06-19 00:47:19] [EMAIL PROTECTED]

Can you please provide the expected result too?
Using the latest CVS the header info seems ok to me.
(no garbage in format)



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

[2005-06-13 19:53:17] andrewz at springsrescuemission dot org

Tested with cvs-latest: problem persists.

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

[2005-06-11 19:47:34] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip



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

[2005-06-09 19:02:47] andrewz at springsrescuemission dot org

Description:
------------
Using PHP's dbase system cannot understand some columns and yields
garbage on a certain .dbf file (http://65.108.181.103/zip.dbf).  

The .dbf was tested successfully with several other programs
(OpenOffice.org 1.1.4 and Shapefile Library C).

According to file, .dbf is dbase 3 format:
$ file zip.dbf
zip.dbf: DBase 3 data file (586 records)

To enable dbase support, I used the standard Trustix 2.2 source RPM and
included "--enable-dbase".

On a different system with PHP 4.3.10 and Linux 2.4.27 (Redhat 7.3), I
verified the problem with dbase_get_record_with_names().  (The function
dbase_get_header_info() was not available on this platform.)

Reproduce code:
---------------
$db = dbase_open("zip.dbf",0);

print_r(dbase_get_header_info($db));

if ($db) {
  $record_numbers = dbase_numrecords($db);
  for ($i = 1; $i <= $record_numbers; $i++) {
        $row = dbase_get_record_with_names($db, $i);
        print_r($row);
  }
}



Expected result:
----------------
The dbase_header_info() does not understand some columns and includes
garbage (e.g. length field).  Then the dbase_get_record_with_names() has
incorrect data.  

Here is output of Shapefile Library C's dbfdump -h on the same zip.dbf.
 This output is good.

Field 0: Type=Double, Title=`AREA', Width=20, Decimals=5
Field 1: Type=Double, Title=`PERIMETER', Width=20, Decimals=5
Field 2: Type=Integer, Title=`ZT08_D00_', Width=11, Decimals=0
Field 3: Type=Integer, Title=`ZT08_D00_I', Width=11, Decimals=0
Field 4: Type=String, Title=`ZCTA', Width=5, Decimals=0
Field 5: Type=String, Title=`NAME', Width=90, Decimals=0
Field 6: Type=String, Title=`LSAD', Width=2, Decimals=0
Field 7: Type=String, Title=`LSAD_TRANS', Width=50, Decimals=0
                AREA            PERIMETER   ZT08_D00_  ZT08_D00_I ZCTA 
NAME                                                                    
                  LSAD LSAD_TRANS
             0.05115              1.30727           2           1 80428
80428                                                                   
                  Z5   5-Digit ZCTA


Actual result:
--------------
SCRIPT OUTPUT 

Array
(
    [0] => Array
        (
            [name] => AREA
            [type] => unknown
            [length] => 1300
            [precision] => 0
            [format] => ´       "@
            [offset] => 1
        )

    [1] => Array
        (
            [name] => PERIMETER
            [type] => unknown
            [length] => 1300
            [precision] => 0
            [format] => ´       "@
            [offset] => 1301
        )


[truncated]


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


-- 
Edit this bug report at http://bugs.php.net/?id=33285&edit=1

Reply via email to