Index: branches/5.0.x/core/units/helpers/cat_dbitem_export_helper.php =================================================================== diff -u -N -r12511 -r12706 --- branches/5.0.x/core/units/helpers/cat_dbitem_export_helper.php (.../cat_dbitem_export_helper.php) (revision 12511) +++ branches/5.0.x/core/units/helpers/cat_dbitem_export_helper.php (.../cat_dbitem_export_helper.php) (revision 12706) @@ -1,6 +1,6 @@ Conn->qstr($var_name), $this->Conn->qstr($var_value) ); } } - $values_sql = preg_replace('/(.*),$/', '\\1', $values_sql); + + $values_sql = substr($values_sql, 0, -1); + if ($values_sql) { $sql = 'INSERT INTO '.$this->cacheTable.'(`CacheName`,`VarName`,`VarValue`) VALUES '.$values_sql; $this->Conn->Query($sql); @@ -391,7 +393,7 @@ $custom_sql .= 'custom_data.'.$ml_formatter->LangFieldName('cust_'.$custom_id).' AS cust_'.$custom_name.', '; } - return preg_replace('/(.*), /', '\\1', $custom_sql); + return substr($custom_sql, 0, -2); } function getPlainExportSQL($count_only = false) { @@ -464,7 +466,7 @@ foreach ($this->exportOptions['export_cats_ids'] as $category_id) { $sql .= '(c.ParentPath LIKE "%|'.$category_id.'|%") OR '; } - $sql = preg_replace('/(.*) OR $/', '\\1', $sql); + $sql = substr($sql, 0, -4); } $sql .= ' ORDER BY ci.PrimaryCat DESC'; // NEW @@ -841,7 +843,7 @@ } } - $where_clause = preg_replace('/(.*) AND $/', '\\1', $where_clause); + $where_clause = substr($where_clause, 0, -5); $item_id = $this->getFromCache('new_ids', crc32($where_clause)); if (!$item_id) { @@ -1105,7 +1107,7 @@ foreach ($this->exportOptions['export_cats_ids'] as $category_id) { $where_clause .= '(c.ParentPath LIKE "%|'.$category_id.'|%") OR '; } - $where_clause = preg_replace('/(.*) OR $/', '\\1', $where_clause); + $where_clause = substr($where_clause, 0, -4); } } else {