Bug #12581 Updated: boolean fields not imported (patches enclosed)

From: Date: Sun, 05 Aug 2001 20:17:48 +0000
Subject: Bug #12581 Updated: boolean fields not imported (patches enclosed)
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-62176@lists.php.net to get a copy of this message
ID: 12581
User updated by: widman-php@cardiothink.com
Reported By: widman-php@cardiothink.com
Status: Open
Bug Type: dBase related
Operating System: Linux 2.2.16-3
PHP Version: 4.0.6
New Comment:

The file name to which the patches apply is ext/dbase/dbase.c.

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

[2001-08-05 16:16:32] widman-php@cardiothink.com

Below are patches that fix the problem reported 10/20/2000 in bug report #7374.  The problem is that
when boolean (TRUE or FALSE) fields are present in an imported Dbase file, the value is always
imported as FALSE (0).  This problem has been present since 4.0.3.  The patches below were generated
using distribution 4.0.6.

466,467c466
<     case 'N':       /* FALLS THROUGH */
<     case 'L':       /* FALLS THROUGH */
---
>     case 'N':
473a473,486
>     case 'L':       /* we used to FALLS THROUGH, but now we check for T/Y and F/N
>                        and insert 1 or 0, respectively.  db_fdc is the number of
>                        decimals, which we don't care about.      3/14/01 LEW */
>           if ( (*str_value == 'T') || ( *str_value == 'Y' ) ){
>                   add_next_index_long(return_value, strtol("1", NULL, 10));
>           } else {
>             if ( (*str_value == 'F') || ( *str_value == 'N' ) ){
>                   add_next_index_long(return_value, strtol("0", NULL, 10));
>             }
>             else {
>                   add_next_index_long(return_value, strtol(" ", NULL, 10));
>                  }
>           }
>           break;
544,545c557
<           case 'N':       /* FALLS THROUGH */
<           case 'L':       /* FALLS THROUGH */
---
>           case 'N':
551a564,578
>           case 'L': /* we used to FALLS THROUGH, but now we check for T/Y and F/N
>                        and insert 1 or 0, respectively.  db_fdc is the number of
>                        decimals, which we don't care about.  3/14/01 LEW */
>                 if ( (*str_value == 'T') || ( *str_value == 'Y') ){
>                     add_assoc_long(return_value, cur_f->db_fname, strtol("1",
> NULL, 10));
>                 } else {
>                   if ( (*str_value == 'F') || ( *str_value == 'N' ) ){
>                       add_assoc_long(return_value, cur_f->db_fname,strtol("0",
> NULL, 10));
>                    }
>                 else {
>                       add_assoc_long(return_value, cur_f->db_fname,strtol(" ",
> NULL, 10));
>                      }
>                 }
>                 break;
>


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



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



Thread (10 messages)

« previous php.dev (#62176) next »