php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12581 boolean fields not imported (patches enclosed)
Submitted: 2001-08-05 16:16 UTC Modified: 2001-08-14 07:02 UTC
From: widman-php at cardiothink dot com Assigned:
Status: Closed Package: dBase related
PHP Version: 4.0.6 OS: Linux 2.2.16-3
Private report: No CVE-ID: None
 [2001-08-05 16:16 UTC] widman-php at cardiothink dot 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;
>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-05 16:17 UTC] widman-php at cardiothink dot com
The file name to which the patches apply is ext/dbase/dbase.c.
 [2001-08-05 16:18 UTC] andy@php.net
this is not a bug...already forwarded to php-dev@lists.php.net

Thanks for your help, but next time just send it to php-dev@lists.php.net
and don't open a bug about it.
 [2001-08-05 16:18 UTC] andy@php.net
status -> bogus
 [2001-08-06 00:50 UTC] sniper@php.net
This is not a bogus report. But please put the patch
file somewhere where it can be downloaded and add
the url here.

Also, create it in unified format against latest CVS:

# cvs diff -u ext/dbase/dbase.c

This will make it more appealing to be committed.. :)

--Jani

 [2001-08-14 07:02 UTC] sniper@php.net
Patch committed. Thanks!

--Jani

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 16:01:27 2024 UTC