From 03d15ff892c3c581d92948ce50998b85eb480440 Mon Sep 17 00:00:00 2001 From: phpnut Date: Thu, 1 Feb 2007 23:43:56 +0000 Subject: [PATCH] Adding fix for #1928 git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4393 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/model/datasources/dbo_source.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cake/libs/model/datasources/dbo_source.php b/cake/libs/model/datasources/dbo_source.php index 669ca474f..71a0599c6 100644 --- a/cake/libs/model/datasources/dbo_source.php +++ b/cake/libs/model/datasources/dbo_source.php @@ -1348,14 +1348,16 @@ class DboSource extends DataSource { for($i = 0; $i < $pregCount; $i++) { if (!empty($match['1'][$i]) && !is_numeric($match['1'][$i])) { - $conditions = preg_replace('/^' . $match['0'][$i] . '/', ' '.$this->name($match['1'][$i]), $conditions); + $conditions = $conditions . ' '; + $conditions = preg_replace('/^' . $match['0'][$i] . '(?=[^\\w])/', ' '.$this->name($match['1'][$i]), $conditions); if (strpos($conditions, '(' . $match['0'][$i]) === false) { - $conditions = preg_replace('/[^\w]' . $match['0'][$i] . '/', ' '.$this->name($match['1'][$i]), $conditions); + $conditions = preg_replace('/[^\w]' . $match['0'][$i] . '(?=[^\\w])/', ' '.$this->name($match['1'][$i]), $conditions); } else { - $conditions = preg_replace('/' . $match['0'][$i] . '/', ' '.$this->name($match['1'][$i]), $conditions); + $conditions = preg_replace('/' . $match['0'][$i] . '(?=[^\\w])/', ' '.$this->name($match['1'][$i]), $conditions); } } } + $conditions = rtrim($conditions); } } return $clause . $conditions;