From:             [EMAIL PROTECTED]
Operating system: Linux 2.2.16-3
PHP version:      4.0.6
PHP Bug Type:     dBase related
Bug description:  boolean fields not imported (patches enclosed)

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 bug report at: http://bugs.php.net/?id=12581&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to