diff options
| author | Moriyoshi Koizumi <moriyoshi@php.net> | 2003-02-18 15:15:22 +0000 |
|---|---|---|
| committer | Moriyoshi Koizumi <moriyoshi@php.net> | 2003-02-18 15:15:22 +0000 |
| commit | d4e9d48b18c23f45fea64065845c735bc50e3896 (patch) | |
| tree | 5c36b964cc979eb2b5f05b049ea36f88e771296b | |
| parent | 724005024363c736612f66c96260ececa463ab58 (diff) | |
| download | php-git-d4e9d48b18c23f45fea64065845c735bc50e3896.tar.gz | |
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
| -rw-r--r-- | ext/standard/file.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c index 65bd7b8e3d..fa7649b45c 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -2529,7 +2529,7 @@ PHP_FUNCTION(fgetcsv) lineEnd = emalloc(len + 1); bptr = buf; 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++; strcpy(lineEnd, tptr); @@ -2551,7 +2551,7 @@ PHP_FUNCTION(fgetcsv) do { /* 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 */ if (enclosure && *bptr == enclosure) { bptr++; /* move on to first character in field */ @@ -2600,7 +2600,7 @@ PHP_FUNCTION(fgetcsv) temp = erealloc(temp, temp_len+1); bptr = buf; 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++; strcpy(lineEnd, tptr); @@ -2621,7 +2621,7 @@ PHP_FUNCTION(fgetcsv) if (strlen(temp)) { tptr--; - while (isspace((int)*tptr) && (*tptr!=delimiter)) + while (isspace((int)*(unsigned char *)tptr) && (*tptr!=delimiter)) *tptr-- = 0; /* strip any trailing spaces */ } |
