From:             
Operating system: Linux (OpenSuse 11.1 64), WinXP
PHP version:      5.2.13
Package:          dBase related
Bug Type:         Bug
Bug description:dbase_get_record_with_names() returns integer instead of 
decimal values

Description:
------------
dbase_get_record_with_names() doesn't work as expected for me:



I run PHP-GTK on four machines:



- Slackware Linux 13.1 32bit   (PHP 5.2.8)

- OpenSuse Linux 11.1 64bit    (PHP 5.2.8)

- Windows Vista 32bit          (PHP 5.2.6)  *OK*

- Windows XP 32bit             (PHP 5.2.6)



Both Windows machines use the exactly same PHP-GTK compilation with PHP
5.2.6, whereas on Linux I run 2 independently compiled PHP/PHP-GTK
installations.



On both Linux machines and on Windows XP dbase_get_record_with_names()
fails to output decimal values (dBase number fields with a precision higher
than 0) correctly, whereas on Vista the output is formatted as expected
(eventhough the compilation used on Vista is exactly the same as the one I
use on XP. I even replaced the installation on XP with the one I have on
Vista, without any effects).



Now, what happens with the output is as follows:



One expects to receive a decimal string when requesting the content of a
number field with the precision of 1 position or higher (ex: 'p2,N,4,2').
Now, what happens is that every position after the comma/dot is stripped
away (on the systems where this error occurs).



I have no idea why it works on Windows Vista, but not on my other machines.
However, I thought it could eventually have to do with
internationalization? In central europe we use to separate the full number
with comma instead of the dot. Is it possible that my Windows Vista somehow
handles that differently than XP, Suse and Slack?



Test script:
---------------
#!/usr/bin/php-gtk

<?php

      echo "\ndBase_get_record_with_names() - - TEST" .

           "\nPHP 5.2.8" .

           "\n======================================\n\n";

      

      // dBase-file

      // ==========

      

      $db_path = "test.dbf";

      

      // open dBase-file

      // ===============

      

      $db = dbase_open($db_path, 0) or die("Failed to open '$db_path'.");

      

      if($db){

         

         // show dBase-header

         // =================

         

         echo "# header info\n\n";

         $info = dbase_get_header_info($db);

         print_r($info);

         

         // show contents

         // =============

         

         echo "\n\n# contents\n\n";

         $rows = dbase_numrecords($db);

         for($i = 1; $i <= $rows; $i++){

            $dBase_row = dbase_get_record_with_names($db, $i);

            print_r($dBase_row);

         }

      }

      

      echo "\n";

?>

Expected result:
----------------
dBase_get_record_with_names() - - TEST

PHP 5.2.8                             

======================================



# header info



Array

(    

    [0] => Array

        (       

            [name] => int

            [type] => number

            [length] => 2   

            [precision] => 0

            [format] => %2s 

            [offset] => 1   

        )                   



    [1] => Array

        (       

            [name] => p2

            [type] => number

            [length] => 4   

            [precision] => 2

            [format] => %4s 

            [offset] => 3   

        )                   



    [2] => Array

        (       

            [name] => p3

            [type] => number

            [length] => 5   

            [precision] => 3

            [format] => %5s 

            [offset] => 7   

        )                   



)





# contents



Array

(

    [int] => 44

    [p2] => 3.56

    [p3] => 6.341

    [deleted] => 0

)

Array

(

    [int] => 55

    [p2] => 1.05

    [p3] => 3.820

    [deleted] => 0

)



Actual result:
--------------
dBase_get_record_with_names() - - TEST

PHP 5.2.8                             

======================================



# header info



Array

(    

    [0] => Array

        (       

            [name] => int

            [type] => number

            [length] => 2   

            [precision] => 0

            [format] => %2s 

            [offset] => 1   

        )                   



    [1] => Array

        (       

            [name] => p2

            [type] => number

            [length] => 4   

            [precision] => 2

            [format] => %4s 

            [offset] => 3   

        )                   



    [2] => Array

        (       

            [name] => p3

            [type] => number

            [length] => 5   

            [precision] => 3

            [format] => %5s 

            [offset] => 7   

        )                   



)





# contents



Array

(

    [int] => 44

    [p2] => 3

    [p3] => 6

    [deleted] => 0

)

Array

(

    [int] => 55

    [p2] => 1

    [p3] => 3

    [deleted] => 0

)



-- 
Edit bug report at http://bugs.php.net/bug.php?id=52112&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=52112&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=52112&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=52112&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=52112&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=52112&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=52112&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=52112&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=52112&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=52112&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=52112&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=52112&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=52112&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=52112&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=52112&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=52112&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=52112&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=52112&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=52112&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=52112&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=52112&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=52112&r=mysqlcfg

Reply via email to