diff options
-rw-r--r-- | it_pipe.class | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/it_pipe.class b/it_pipe.class index e009556..1c890a8 100644 --- a/it_pipe.class +++ b/it_pipe.class @@ -196,6 +196,7 @@ function cols($collist, $separator = "\t") * @param $p['forceschema'] ignore schema in file, replace it with this comma separated column list * @param $p['fixcolnames'] replace non-identifier chars in colum names * @param $p['it_error'] error params + * @return array of objects or empty array on format violations */ function csv($p = []) { @@ -215,7 +216,7 @@ function csv($p = []) if (($cols = str_getcsv($line, $splitchar, '"')) && count($schema) == count($cols)) $records[] = (object)array_combine($schema, $cols); else - it::error((array)$p['it_error'] + ['title' => "schema mismatch: " . count($schema) . " vs " . count($cols), 'body' => [$schema, $line]]); + return (array)it::error((array)$p['it_error'] + ['title' => "schema mismatch: " . count($schema) . " vs " . count($cols), 'body' => [$schema, $line]]); } setlocale(LC_CTYPE, $oldlocale); |