diff --git a/cake/libs/model/datasources/dbo_source.php b/cake/libs/model/datasources/dbo_source.php index ab63108a68a..2dc87e90b66 100755 --- a/cake/libs/model/datasources/dbo_source.php +++ b/cake/libs/model/datasources/dbo_source.php @@ -484,26 +484,26 @@ function name($data) { } return $data; } - $cacheKey = crc32($data); + $cacheKey = crc32($this->startQuote.$data.$this->endQuote); if (isset($this->methodCache[__FUNCTION__][$cacheKey])) { return $this->methodCache[__FUNCTION__][$cacheKey]; } $data = trim($data); if (preg_match('/^[\w-]+(\.[\w-]+)*$/', $data)) { // string, string.string if (strpos($data, '.') === false) { // string - return $this->startQuote . $data . $this->endQuote; + return $this->methodCache[__FUNCTION__][$cacheKey] = $this->startQuote . $data . $this->endQuote; } $items = explode('.', $data); - return $this->startQuote . implode($this->endQuote . '.' . $this->startQuote, $items) . $this->endQuote; + return $this->methodCache[__FUNCTION__][$cacheKey] = $this->startQuote . implode($this->endQuote . '.' . $this->startQuote, $items) . $this->endQuote; } if (preg_match('/^[\w-]+\.\*$/', $data)) { // string.* - return $this->startQuote . str_replace('.*', $this->endQuote . '.*', $data); + return $this->methodCache[__FUNCTION__][$cacheKey] = $this->startQuote . str_replace('.*', $this->endQuote . '.*', $data); } if (preg_match('/^([\w-]+)\((.*)\)$/', $data, $matches)) { // Functions - return $matches[1] . '(' . $this->name($matches[2]) . ')'; + return $this->methodCache[__FUNCTION__][$cacheKey] = $matches[1] . '(' . $this->name($matches[2]) . ')'; } if (preg_match('/^([\w-]+(\.[\w-]+|\(.*\))*)\s+' . preg_quote($this->alias) . '\s*([\w-]+)$/', $data, $matches)) { - return preg_replace('/\s{2,}/', ' ', $this->name($matches[1]) . ' ' . $this->alias . ' ' . $this->name($matches[3])); + return $this->methodCache[__FUNCTION__][$cacheKey] = preg_replace('/\s{2,}/', ' ', $this->name($matches[1]) . ' ' . $this->alias . ' ' . $this->name($matches[3])); } return $this->methodCache[__FUNCTION__][$cacheKey] = $data; }