[PHP-DEV] Bug #5993 Updated: numeric fields with field len 10 are chopped

2001-12-13 Thread vlad

ID: 5993
Updated by: vlad
Reported By: [EMAIL PROTECTED]
Old Status: Assigned
Status: Closed
Bug Type: dBase related
Operating System: Linux
PHP Version: 4.0.1pl2
Assigned To: vlad
New Comment:

fixed. Now if the integer returned can't fit in a long, we keep it as a string. You 
can tell if an overflow occurred by looking at the return type (long vs string).

Both dbase_get_record() and dbase_get_record_with_names() got fixed.

Still need to update documentation to reflect that chage.



Previous Comments:


[2001-10-30 19:00:23] [EMAIL PROTECTED]

status - assigned




[2001-05-29 23:03:29] [EMAIL PROTECTED]

Numerical values can be represented by up to 18 characters of text. They can be up to 
20 characters long in FoxPro and Clipper. Even 10 characters is more than we can fit 
in a long right? So, this is a bug even for numbers represented by 10 characters.

Question: Should we just return those large numbers as text (since we do not have an 
appropriate datatype in PHP) and say so clearly in documentation, or should we just 
always return them as text (which is more consistent, and shouldn't break too many 
things since text and integers in PHP are not all that different as far as users are 
concerned.

I'd opt for the first option. It won't break anyone's stuff, and will allow people 
with large integers to still use it. I want to see if anyone has a different opinion, 
and if not, I'll implement a fix (first option).

I'll also assign it to myself (hope nobody minds)

Vlad




[2001-03-16 14:46:36] [EMAIL PROTECTED]

this also seems to do funny things to HTTP_SERVER_VARS['argv']



[2000-09-29 09:15:22] [EMAIL PROTECTED]

This isn't fixed.

--Jani



[2000-08-23 08:55:38] [EMAIL PROTECTED]

Is this one fixed in newer versions of php4?
(CVS or snaps.php.net)

--Jani



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/?id=5993


Edit this bug report at http://bugs.php.net/?id=5993edit=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]




[PHP-DEV] Bug #5993 Updated: numeric fields with field len 10 are chopped

2001-10-30 Thread sniper

ID: 5993
Updated by: sniper
Reported By: [EMAIL PROTECTED]
Old Status: Analyzed
Status: Assigned
Bug Type: dBase related
Operating System: Linux
PHP Version: 4.0.1pl2
Assigned To: vlad
New Comment:

status - assigned


Previous Comments:


[2001-05-29 23:03:29] [EMAIL PROTECTED]

Numerical values can be represented by up to 18 characters of text. They can be up to 
20 characters long in FoxPro and Clipper. Even 10 characters is more than we can fit 
in a long right? So, this is a bug even for numbers represented by 10 characters.

Question: Should we just return those large numbers as text (since we do not have an 
appropriate datatype in PHP) and say so clearly in documentation, or should we just 
always return them as text (which is more consistent, and shouldn't break too many 
things since text and integers in PHP are not all that different as far as users are 
concerned.

I'd opt for the first option. It won't break anyone's stuff, and will allow people 
with large integers to still use it. I want to see if anyone has a different opinion, 
and if not, I'll implement a fix (first option).

I'll also assign it to myself (hope nobody minds)

Vlad




[2001-03-16 14:46:36] [EMAIL PROTECTED]

this also seems to do funny things to HTTP_SERVER_VARS['argv']



[2000-09-29 09:15:22] [EMAIL PROTECTED]

This isn't fixed.

--Jani



[2000-08-23 08:55:38] [EMAIL PROTECTED]

Is this one fixed in newer versions of php4?
(CVS or snaps.php.net)

--Jani



[2000-08-06 18:44:05] [EMAIL PROTECTED]

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.cSun 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));
}






Edit this bug report at http://bugs.php.net/?id=5993edit=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]