Permalink
Browse files

Merge branch 'hotfix/2670'

Close #2670
  • Loading branch information...
2 parents 03a5858 + 83ca33c commit 2d1b40b75438e7f287341e19f311db5c6b9699b3 @akrabat akrabat committed Nov 15, 2012
Showing with 8 additions and 3 deletions.
  1. +3 −3 library/Zend/Db/Adapter/Platform/Mysql.php
  2. +5 −0 tests/ZendTest/Db/Adapter/Platform/MysqlTest.php
@@ -46,7 +46,7 @@ public function getQuoteIdentifierSymbol()
*/
public function quoteIdentifier($identifier)
{
- return '`' . str_replace('`', '\\' . '`', $identifier) . '`';
+ return '`' . str_replace('`', '``', $identifier) . '`';
}
/**
@@ -57,7 +57,7 @@ public function quoteIdentifier($identifier)
*/
public function quoteIdentifierChain($identifierChain)
{
- $identifierChain = str_replace('`', '\\`', $identifierChain);
+ $identifierChain = str_replace('`', '``', $identifierChain);
if (is_array($identifierChain)) {
$identifierChain = implode('`.`', $identifierChain);
}
@@ -134,7 +134,7 @@ public function quoteIdentifierInFragment($identifier, array $safeWords = array(
case 'as':
break;
default:
- $parts[$i] = '`' . str_replace('`', '\\' . '`', $part) . '`';
+ $parts[$i] = '`' . str_replace('`', '``', $part) . '`';
}
}
return implode('', $parts);
@@ -50,6 +50,7 @@ public function testGetQuoteIdentifierSymbol()
public function testQuoteIdentifier()
{
$this->assertEquals('`identifier`', $this->platform->quoteIdentifier('identifier'));
+ $this->assertEquals('`ident``ifier`', $this->platform->quoteIdentifier('ident`ifier'));
}
/**
@@ -60,6 +61,10 @@ public function testQuoteIdentifierChain()
$this->assertEquals('`identifier`', $this->platform->quoteIdentifierChain('identifier'));
$this->assertEquals('`identifier`', $this->platform->quoteIdentifierChain(array('identifier')));
$this->assertEquals('`schema`.`identifier`', $this->platform->quoteIdentifierChain(array('schema','identifier')));
+
+ $this->assertEquals('`ident``ifier`', $this->platform->quoteIdentifierChain('ident`ifier'));
+ $this->assertEquals('`ident``ifier`', $this->platform->quoteIdentifierChain(array('ident`ifier')));
+ $this->assertEquals('`schema`.`ident``ifier`', $this->platform->quoteIdentifierChain(array('schema','ident`ifier')));
}
/**

0 comments on commit 2d1b40b

Please sign in to comment.