From fca15328ed73646d809fb9ab767c7f7928aaff62 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Wed, 29 Feb 2012 13:55:19 +0000 Subject: handle schema with empty column names --- it_pipe.class | 2 ++ 1 file changed, 2 insertions(+) (limited to 'it_pipe.class') diff --git a/it_pipe.class b/it_pipe.class index 6847a5d..d002b5b 100644 --- a/it_pipe.class +++ b/it_pipe.class @@ -154,6 +154,8 @@ function csv() $counts = count_chars($this->lines[0]); $splitchar = $counts[ord("\t")] ? "\t" : ($counts[ord(";")] > $counts[ord(",")] ? ";" : ","); $schema = str_getcsv(trim(array_shift($this->lines), "#\n "), $splitchar, '"'); # could do a function_exists('str_getcsv') here... + foreach (preg_grep('/^$/', $schema) as $idx => $dummy) + $schema[$idx] = "field$idx"; $oldlocale = setlocale(LC_CTYPE, 'de_CH.iso-8859-1'); -- cgit v1.2.3