PHP 4.0 Bug #5993: numeric fields with field len > 10 are chopped
| From: | bazsi at balabit dot hu | Date: | Sun, 06 Aug 2000 16:44:05 +0000 |
| Subject: | PHP 4.0 Bug #5993: numeric fields with field len > 10 are chopped | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-27950@lists.php.net to get a copy of this message | ||
From: bazsi@balabit.hu
Operating system: Linux
PHP version: 4.0.1pl2
PHP Bug Type: dBase related
Bug description: numeric fields with field len > 10 are chopped
Here's the patch to fix the bug above:
diff -urN php-4.0.1pl2/ext/dbase/dbase.c php-4.0.1pl2.bazsi/ext/dbase/dbase.c
--- php-4.0.1pl2/ext/dbase/dbase.c Sun Jun 25 19:02:44 2000
+++ php-4.0.1pl2.bazsi/ext/dbase/dbase.c Sun Aug 6 18:42:16 2000
@@ -455,7 +455,12 @@
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));
+ if (cur_f->db_flen >= 10) {
+ add_next_index_string(return_value, str_value, 1);
+ }
+ else {
+ add_next_index_long(return_value, strtol(str_value, NULL,
10));
+ }
} else {
add_next_index_double(return_value, atof(str_value));
}