From: Hartmut Holzgraefe Date: Tue, 18 Jun 2002 12:16:27 +0000 (+0000) Subject: - fixed bug in enclosure handling (was still hardcoded to '"' in one place) X-Git-Tag: php-4.3.0dev_zend2_alpha2~202 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=303852b42ec8f158361d2f49745aa9ecbfad611c;p=php - fixed bug in enclosure handling (was still hardcoded to '"' in one place) - added possibility to pass empty enclosure if you really don't want one --- diff --git a/ext/standard/file.c b/ext/standard/file.c index badcce3a34..ee98e133a6 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1976,12 +1976,6 @@ PHP_FUNCTION(fgetcsv) delimiter = Z_STRVAL_PP(p_delim)[0]; convert_to_string_ex(p_enclosure); - /* Make sure that there is at least one character in string */ - if (Z_STRLEN_PP(p_enclosure) < 1) { - php_error(E_WARNING, "%s() 4th parameter must be a character", - get_active_function_name(TSRMLS_C)); - return; - } /* use first character from string */ enclosure = Z_STRVAL_PP(p_enclosure)[0]; @@ -2042,13 +2036,13 @@ PHP_FUNCTION(fgetcsv) /* 1. Strip any leading space */ while(isspace((int) *bptr) && (*bptr!=delimiter)) bptr++; /* 2. Read field, leaving bptr pointing at start of next field */ - if (*bptr == enclosure) { + if (enclosure && *bptr == enclosure) { /* 2A. handle enclosure delimited field */ bptr++; /* move on to first character in field */ while (*bptr) { if (*bptr == enclosure) { /* handle the enclosure */ - if ( *(bptr+1) == '"') { + if ( *(bptr+1) == enclosure) { /* embedded enclosure */ *tptr++ = *bptr; bptr +=2; } else {