mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 08:36:39 +00:00
$this->auto_non_chars didn't work the way I would have expected:
The "-" was taken literally, and thus 0 was forbidden, but 1 was allowed. Fixes #55. Also see #61
This commit is contained in:
@@ -905,8 +905,8 @@ class parseCSV {
|
||||
/**
|
||||
* Validate a row against a single condition
|
||||
*
|
||||
* @param array $row array with values from a row
|
||||
* @param string $condition specified condition that the row must match
|
||||
* @param array $row array with values from a row
|
||||
* @param string $condition specified condition that the row must match
|
||||
*
|
||||
* @return string single 0 or 1
|
||||
*/
|
||||
@@ -1181,7 +1181,12 @@ class parseCSV {
|
||||
$enclosed = false;
|
||||
$current_row = 1;
|
||||
$to_end = true;
|
||||
$pattern = '/[' . preg_quote($this->auto_non_chars, '/') . ']/i';
|
||||
|
||||
// The dash is the only character we don't want quoted, as it would
|
||||
// prevent character ranges within $auto_non_chars:
|
||||
$quoted_auto_non_chars = preg_quote($this->auto_non_chars, '/');
|
||||
$quoted_auto_non_chars = str_replace('\-', '-', $quoted_auto_non_chars);
|
||||
$pattern = '/[' . $quoted_auto_non_chars . ']/i';
|
||||
|
||||
// walk specific depth finding possible delimiter characters
|
||||
for ($i = 0; $i < $strlen; $i++) {
|
||||
|
||||
Reference in New Issue
Block a user