From: [EMAIL PROTECTED] Operating system: Redhat 6.2 PHP version: 4.0.4pl1 PHP Bug Type: dBase related Bug description: Reading logical values doesn't work: fix attached Reading logical values doesn't work, apparently because in dbase.c logicals are interpreted as integers. So, the following patch treats logicals as their own selves. If the original value is 'T' or 'Y', the imported value is 1. If the original value is 'F' or 'N', the imported value is 0. Otherwise, the imported value is whatever ' ' maps into (probably 0). I have verified that the first two sets of cases works fine. The following diff was generated with "diff -wrc". I apologize for the wrap-around in this textarea. I'll be happy to email the original to you if you like, or you can find it at http://www.tcacc.org/dbase.diff *** dbase.c Tue Mar 13 23:40:10 2001 --- dbase.c.DISTRIB Thu Nov 2 16:08:04 2000 *************** *** 459,485 **** case 'D': add_next_index_string(return_value,str_value,1); break; ! case 'N': if (cur_f->db_fdc == 0) { add_next_index_long(return_value, strtol(str_value, NULL, 10)); } else { add_next_index_double(return_value, atof(str_value)); } break; - 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; case 'M': /* this is a memo field. don't know how to deal with this yet */ --- 459,472 ---- case 'D': add_next_index_string(return_value,str_value,1); break; ! case 'N': /* FALLS THROUGH */ ! case 'L': /* FALLS THROUGH */ if (cur_f->db_fdc == 0) { add_next_index_long(return_value, strtol(str_value, NULL, 10)); } else { add_next_index_double(return_value, atof(str_value)); } break; case 'M': /* this is a memo field. don't know how to deal with this yet */ *************** *** 550,577 **** case 'D': add_assoc_string(return_value,cur_f->db_fname,str_value,1); break; ! case 'N': if (cur_f->db_fdc == 0) { add_assoc_long(return_value,cur_f->db_fname,strtol(str_value, NULL , 10)); } else { add_assoc_double(return_value,cur_f->db_fname,atof(str_value)); break; - 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; - case 'M': /* this is a memo field. don't know how to deal with this yet */ break; --- 537,550 ---- case 'D': add_assoc_string(return_value,cur_f->db_fname,str_value,1); break; ! case 'N': /* FALLS THROUGH */ ! case 'L': /* FALLS THROUGH */ if (cur_f->db_fdc == 0) { add_assoc_long(return_value,cur_f->db_fname,strtol(str_value, NULL , 10)); } else { add_assoc_double(return_value,cur_f->db_fname,atof(str_value)); } break; case 'M': /* this is a memo field. don't know how to deal with this yet */ break; } -- Edit Bug report at: http://bugs.php.net/?id=9739&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]