cvs: php4 /ext/standard file.c
| From: | Hartmut Holzgraefe | Date: | Tue, 18 Jun 2002 12:16:45 +0000 |
| Subject: | cvs: php4 /ext/standard file.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-12403@lists.php.net to get a copy of this message | ||
hholzgra Tue Jun 18 08:16:45 2002 EDT
Modified files:
/php4/ext/standard file.c
Log:
- 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
Index: php4/ext/standard/file.c
diff -u php4/ext/standard/file.c:1.233 php4/ext/standard/file.c:1.234
--- php4/ext/standard/file.c:1.233 Mon Jun 10 06:28:33 2002
+++ php4/ext/standard/file.c Tue Jun 18 08:16:27 2002
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.233 2002/06/10 10:28:33 mfischer Exp $ */
+/* $Id: file.c,v 1.234 2002/06/18 12:16:27 hholzgra Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -1976,12 +1976,6 @@
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 @@
/* 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 {