While figuring out our import / export data exchange module, we ran across this problem in inc/classes/BxDolPFM.php, starting at line 1227. Looks like it needs to quote values before joining, not after, in case values contain commas.
$sValuesAlter = implode( ', ', $aValuesAlter );
$sValuesAlter = str_replace( '\\', '\\\\', $sValuesAlter );
$sValuesAlter = str_replace( '\'', '\\\'', $sValuesAlter );
It should probably be done the same way it's done above, by looping through:
foreach( $aValuesAlter as $iKey => $sValue ){ //add slashes to every value
$sValue = str_replace( '\\', '\\\\', $sValue );
$sValue = str_replace( '\'', '\\\'', $sValue );
$aValuesAlter[$iKey] = $sValue;
}
Of course, there's probably a better way, that wouldn't need to duplicated lines of code. Or maybe with array_walk or something like that (in perl it would be map). But imploding an array with commas, then operating on it, is going to be a problem. Imploding after it's been escaped would be better.
Tac