[PHP-DEV] Re: Bug #12581 Updated: ....

2001-08-14 Thread Lawrence E. Widman

Jani,

 ID: 12581
 Updated by: sniper
 Reported By: [EMAIL PROTECTED]
 Old Status: Feedback
 Status: Closed
 Bug Type: dBase related
 Operating System: Linux 2.2.16-3
 PHP Version: 4.0.6
 New Comment:
 
 Patch committed. Thanks!

And thank you! - Larry Widman




-- 
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] PATCH for #12581, #7374: dbase boolean import error (take 2)

2001-08-08 Thread Lawrence E. Widman

I have put the patch for this problem in ext/dbase/dbase.c as
diff -u against the CVS of 7 Aug 2001 in
http://www.cardiothink.com/downloads/dbase.diff-u.20010806.patch

RCS Id line in the ext/dbase/dbase.c file in the CVS copy I
used is:
/* $Id: dbase.c,v 1.45 2001/08/06 12:26:55 sniper Exp $ */

The patch is released to the PHP group under the PHP License.
Please edit to fit. The patch is released under the GPL to
anyone else who might want it.  Anyone who doesn't want it
under the GPL may also have it under the PHP License.  Credit
as appropriate would be appreciated. Please let me know if I
can provide any further information.

- Larry Widman (widman at cardiothink.com)

P.S.  Thanks to Andi Gutmans (andi at zend.com) who pointed out
diplomatically that patches to PHP must be released under the
PHP License.  Flames should be directed to me, not to him. - LW

-- 
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] PATCH for #12581, #7374: dbase boolean import error

2001-08-07 Thread Lawrence E. Widman

I have put the patch for this problem in ext/dbase/dbase.c as
diff -u against today's CVS in
http://www.cardiothink.com/downloads/dbase.diff-u.20010806.patch

RCS Id line in the ext/dbase/dbase.c file in the CVS copy I
used is:
/* $Id: dbase.c,v 1.45 2001/08/06 12:26:55 sniper Exp $ */

The patch is released under the GNU license.  Please edit to
fit.  Credit as appropriate would be appreciated. Please let me
know if I can provide any further information.

- Larry Widman (widman at cardiothink.com)

-- 
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 #12581: boolean fields not imported (patches enclosed)

2001-08-05 Thread widman-php

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=12581edit=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 #12581 Updated: boolean fields not imported (patches enclosed)

2001-08-05 Thread widman-php

ID: 12581
User updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: dBase related
Operating System: Linux 2.2.16-3
PHP Version: 4.0.6
New Comment:

The file name to which the patches apply is ext/dbase/dbase.c.

Previous Comments:


[2001-08-05 16:16:32] [EMAIL PROTECTED]

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 this bug report at http://bugs.php.net/?id=12581edit=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] Re: Bug #12581 Updated: boolean fields not imported (patches enclosed)

2001-08-05 Thread Lawrence E. Widman

Andy,

 this is not a bug...already forwarded to [EMAIL PROTECTED]
 
 Thanks for your help, but next time just send it to [EMAIL PROTECTED]
 and don't open a bug about it.

Man, what a fast reply!  I didn't think I should open a bug
report about it, but I submitted the same patches to somewhere
in php-land in 3/01 and never heard anything back

Just out of curiosity, why is this not a bug?  The program
behavior is incorrect, and patches fix it.  Surely it's not a
feature?  In fact, there is a bug report (#7374) from
10/20/2000 for the same problem that remains open (i.e.,
unsolved). :)

Cheers - Larry

-- 
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] Re: Bug #7474 Updated: ext/standard/scanf.c reports strtol/strtoul undefined reference

2001-05-22 Thread Lawrence E. Widman

Jani,

 ID: 7474
 Updated by: sniper
 Reported By: [EMAIL PROTECTED]
 Old-Status: Open
 Status: Feedback
 Bug Type: Compile Failure
 Operating system: 
 PHP Version: 4.0.5 ?
 Assigned To: 
 Comments:
 
 I guess this still happens with PHP 4.0.5 too?

I don't know. I've given up on SunOs 4.1.4 and am switching to
Linux for our server :)

The Sun box is still running.  Let me know if you would like me
to test PHP 4.0.5 on it.

Thanks for following up! - Larry

-- 
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] PHP 4.0 Bug #9739: Reading logical values doesn't work: fix attached

2001-03-13 Thread widman

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 
  

[PHP-DEV] PHP 4.0 Bug #7474 Updated: ext/standard/scanf.c reports strtol/strtoul undefined reference

2001-01-16 Thread widman

ID: 7474
User Update by: [EMAIL PROTECTED]
Status: Open
Bug Type: Compile Failure
Description: ext/standard/scanf.c reports strtol/strtoul "undefined reference"

The snapshot of 200101160445 failed to compile with the same error as that of 4.0.4pl1.

Previous Comments:
---

[2001-01-16 08:03:14] [EMAIL PROTECTED]
I just tried to compile 4.0.4pl1 and it failed the same way:
gcc  -I. [snip] -c scanf.c  touch scanf.lo
scanf.c: In function `php_sscanf_internal':
scanf.c:783: `strtol' undeclared (first use this function)
scanf.c:783: (Each undeclared identifier is reported only once
scanf.c:783: for each function it appears in.)
scanf.c:804: `strtoul' undeclared (first use this function)
*** Error code 1  

I'll try a snapshot next.  Thanks - Larry

---

[2000-12-18 10:44:07] [EMAIL PROTECTED]
Does this happen with latest snapshot from http://snaps.php.net/ ??

--Jani

---

[2000-10-26 00:42:20] [EMAIL PROTECTED]
I went through and found all the files that use strtol without type-casting.  They 
are:
 ./ext/dbase/dbase.c
 ./ext/session/mod_files.c
 ./ext/standard/formatted_print.c
 ./ext/standard/scanf.c
 ./ext/standard/string.c
 ./ext/wddx/wddx.c
 ./main/fopen-wrappers.c
 ./main/php_ini.c
 ./sapi/nsapi/nsapi.c
 ./Zend/zend_operators.c
 ./Zend/zend_operators.h
 ./Zend/zend-scanner.c  
I added the first set of function prototypes in my first message (the ones that are 
commented out) to each of the above files, except that the last 3 files required 
"ulong" to be spelled out as "unsigned long" for strtoul.  The others took ulong OK.

The compile was successful.  Now let's see if php4 works.  I'm sending this now 
because it may take a while for any bugs related to this fix to appear.

Thanks again for your hard work.  I hope these comments help the next poor soul who is 
still working with SunOs 4.1.4.

---

[2000-10-26 00:07:37] [EMAIL PROTECTED]
SunOs 4.1.4 has strtol (at least, the man page for it). And,
ext/mysql/libmysql has a replacement for strtol/strtoul.

But, the "out of the box" compile fails in ext/standard/scanf.c with the complaint: 
strtol/strtoul are "undefined references".  I tried to cut and paste from the files in 
ext/mysql/libmysql but got a zillion compiler errors.

Then, I added the following to the start of scanf.c based on the SunOs man page:
  long strtol( char *str, char **ptr, int base );
  ulong strtoul( char *str, char **ptr, int base );
The compile succeeded, but complained that these functions had been defined as int 
implicitly in ./Zend/zend_operators.c.  I then changed the added lines to
  int strtol( char *str, char **ptr, int base );
  int strtoul( char *str, char **ptr, int base );
These lines allowed the file to compile without warnings,
and the rest of the php4 compile proceeded smoothly.  I guess I'll just have to see 
whether I should have gone through the entire package and defined these functions as 
long/ulong everywhere instead of making them "int" in this one file.

I don't know how best to handle this idiosyncracy in the php4 package.  I searched 
everything in /usr/include for definitions of strtol and strtoul, but couldn't find 
any files that define them.  Maybe you could include a short .h file with these 
definitions, or add them to a global file for those systems that don't define these 
right.

Thanks for all your hard work! - Larry Widman


---


Full Bug description available at: http://bugs.php.net/?id=7474


-- 
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]