mirror of
https://github.com/php/php-src.git
synced 2025-08-20 09:24:05 +02:00
Fixed bug #21689 (fgetcsv suppresses some characters before a separator)
The fix is suggested by Masahiro Nakayama <masa@sfc.wide.ad.jp> # is* functions expect their argument to be an integer in range of 0-255
This commit is contained in:
parent
7240050243
commit
d4e9d48b18
1 changed files with 4 additions and 4 deletions
|
@ -2529,7 +2529,7 @@ PHP_FUNCTION(fgetcsv)
|
||||||
lineEnd = emalloc(len + 1);
|
lineEnd = emalloc(len + 1);
|
||||||
bptr = buf;
|
bptr = buf;
|
||||||
tptr = buf + strlen(buf) -1;
|
tptr = buf + strlen(buf) -1;
|
||||||
while ( isspace((int) *tptr) && (*tptr!=delimiter) && (tptr > bptr) ) tptr--;
|
while ( isspace((int)*(unsigned char *)tptr) && (*tptr!=delimiter) && (tptr > bptr) ) tptr--;
|
||||||
tptr++;
|
tptr++;
|
||||||
strcpy(lineEnd, tptr);
|
strcpy(lineEnd, tptr);
|
||||||
|
|
||||||
|
@ -2551,7 +2551,7 @@ PHP_FUNCTION(fgetcsv)
|
||||||
|
|
||||||
do {
|
do {
|
||||||
/* 1. Strip any leading space */
|
/* 1. Strip any leading space */
|
||||||
while(isspace((int) *bptr) && (*bptr!=delimiter)) bptr++;
|
while(isspace((int)*(unsigned char *)bptr) && (*bptr!=delimiter)) bptr++;
|
||||||
/* 2. Read field, leaving bptr pointing at start of next field */
|
/* 2. Read field, leaving bptr pointing at start of next field */
|
||||||
if (enclosure && *bptr == enclosure) {
|
if (enclosure && *bptr == enclosure) {
|
||||||
bptr++; /* move on to first character in field */
|
bptr++; /* move on to first character in field */
|
||||||
|
@ -2600,7 +2600,7 @@ PHP_FUNCTION(fgetcsv)
|
||||||
temp = erealloc(temp, temp_len+1);
|
temp = erealloc(temp, temp_len+1);
|
||||||
bptr = buf;
|
bptr = buf;
|
||||||
tptr = buf + strlen(buf) -1;
|
tptr = buf + strlen(buf) -1;
|
||||||
while (isspace((int) *tptr) && (*tptr!=delimiter) && (tptr > bptr))
|
while (isspace((int)*(unsigned char *)tptr) && (*tptr!=delimiter) && (tptr > bptr))
|
||||||
tptr--;
|
tptr--;
|
||||||
tptr++;
|
tptr++;
|
||||||
strcpy(lineEnd, tptr);
|
strcpy(lineEnd, tptr);
|
||||||
|
@ -2621,7 +2621,7 @@ PHP_FUNCTION(fgetcsv)
|
||||||
|
|
||||||
if (strlen(temp)) {
|
if (strlen(temp)) {
|
||||||
tptr--;
|
tptr--;
|
||||||
while (isspace((int)*tptr) && (*tptr!=delimiter))
|
while (isspace((int)*(unsigned char *)tptr) && (*tptr!=delimiter))
|
||||||
*tptr-- = 0; /* strip any trailing spaces */
|
*tptr-- = 0; /* strip any trailing spaces */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue