parseCSV 0.3.2

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.

git-svn-id: http://parsecsv-for-php.googlecode.com/svn/trunk@22 339761fc-0c37-0410-822d-8b8cac1f6a97
This commit is contained in:
zynode
2008-03-31 22:50:36 +00:00
parent 4e76da5eff
commit ae00f949f0
3 changed files with 38 additions and 5 deletions

View File

@@ -4,7 +4,7 @@ class parseCSV {
/*
Class: parseCSV v0.3.2 beta
Class: parseCSV v0.3.2
http://code.google.com/p/parsecsv-for-php/
@@ -503,11 +503,11 @@ class parseCSV {
function _validate_row_conditions ($row = array(), $conditions = null) {
if ( !empty($row) ) {
if ( !empty($conditions) ) {
$conditions = (strpos($conditions, 'OR') !== false) ? explode('OR', $conditions) : array($conditions) ;
$conditions = (strpos($conditions, ' OR ') !== false) ? explode(' OR ', $conditions) : array($conditions) ;
$or = '';
foreach( $conditions as $key => $value ) {
if ( strpos($value, 'AND') !== false ) {
$value = explode('AND', $value);
if ( strpos($value, ' AND ') !== false ) {
$value = explode(' AND ', $value);
$and = '';
foreach( $value as $k => $v ) {
$and .= $this->_validate_row_condition($row, $v);