mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 08:36:39 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae00f949f0 | ||
|
|
4e76da5eff |
@@ -1,3 +1,29 @@
|
|||||||
|
parseCSV 0.3.2
|
||||||
|
-----------------------------------
|
||||||
|
Date: 1-Apr-2008
|
||||||
|
|
||||||
|
This is primarily a bug-fix release for a critical
|
||||||
|
bug which was brought to my attention.
|
||||||
|
|
||||||
|
- Fixed a critical bug in conditions parsing which
|
||||||
|
would generate corrupt matching patterns causing
|
||||||
|
the condition(s) to not work at all in some
|
||||||
|
situations.
|
||||||
|
|
||||||
|
- Fixed a small code error which would cause PHP to
|
||||||
|
generate a invalid offset notice when zero length
|
||||||
|
values were fed into the unparse() method to
|
||||||
|
generate CSV data from an array.
|
||||||
|
|
||||||
|
Notice: If you have been using the "parsecsv-stable"
|
||||||
|
branch as an external in any of your projects,
|
||||||
|
please use the "stable/parsecsv" branch from this
|
||||||
|
point on as I will eventually remove the former due
|
||||||
|
to it's stupid naming.
|
||||||
|
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
|
||||||
parseCSV 0.3.1
|
parseCSV 0.3.1
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
Date: 1-Sep-2007
|
Date: 1-Sep-2007
|
||||||
@@ -31,6 +57,9 @@ Date: 9-Aug-2007
|
|||||||
- Minor changes and optimizations, and a few
|
- Minor changes and optimizations, and a few
|
||||||
spelling corrections. Oops :)
|
spelling corrections. Oops :)
|
||||||
|
|
||||||
|
- Included more complex code examples in the
|
||||||
|
parseCSV download.
|
||||||
|
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,11 @@ $csv = new parseCSV();
|
|||||||
# Parse '_books.csv' using automatic delimiter detection...
|
# Parse '_books.csv' using automatic delimiter detection...
|
||||||
$csv->auto('_books.csv');
|
$csv->auto('_books.csv');
|
||||||
|
|
||||||
# ...or if you know the delimiter, use the parse() function.
|
# ...or if you know the delimiter, set the delimiter character
|
||||||
|
# if its not the default comma...
|
||||||
|
// $csv->delimiter = "\t"; # tab delimited
|
||||||
|
|
||||||
|
# ...and then use the parse() function.
|
||||||
// $csv->parse('_books.csv');
|
// $csv->parse('_books.csv');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class parseCSV {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Class: parseCSV v0.3.1
|
Class: parseCSV v0.3.2
|
||||||
http://code.google.com/p/parsecsv-for-php/
|
http://code.google.com/p/parsecsv-for-php/
|
||||||
|
|
||||||
|
|
||||||
@@ -601,12 +601,14 @@ class parseCSV {
|
|||||||
* @return Processed value
|
* @return Processed value
|
||||||
*/
|
*/
|
||||||
function _enclose_value ($value = null) {
|
function _enclose_value ($value = null) {
|
||||||
|
if ( $value !== null && $value != '' ) {
|
||||||
$delimiter = preg_quote($this->delimiter, '/');
|
$delimiter = preg_quote($this->delimiter, '/');
|
||||||
$enclosure = preg_quote($this->enclosure, '/');
|
$enclosure = preg_quote($this->enclosure, '/');
|
||||||
if ( preg_match("/".$delimiter."|".$enclosure."|\n|\r/i", $value) || ($value{0} == ' ' || substr($value, -1) == ' ') ) {
|
if ( preg_match("/".$delimiter."|".$enclosure."|\n|\r/i", $value) || ($value{0} == ' ' || substr($value, -1) == ' ') ) {
|
||||||
$value = str_replace($this->enclosure, $this->enclosure.$this->enclosure, $value);
|
$value = str_replace($this->enclosure, $this->enclosure.$this->enclosure, $value);
|
||||||
$value = $this->enclosure.$value.$this->enclosure;
|
$value = $this->enclosure.$value.$this->enclosure;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user