mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-02 01:22:37 +00:00
Fixing issue where table names with spaces would not be quoted by name(). Fixes #1121
This commit is contained in:
parent
b648b61422
commit
729a45703b
2 changed files with 8 additions and 0 deletions
|
@ -571,6 +571,9 @@ class DboSource extends DataSource {
|
|||
)
|
||||
);
|
||||
}
|
||||
if (preg_match('/^[\w-_\s]*[\w-_]+/', $data)) {
|
||||
return $this->cacheMethod(__FUNCTION__, $cacheKey, $this->startQuote . $data . $this->endQuote);
|
||||
}
|
||||
return $this->cacheMethod(__FUNCTION__, $cacheKey, $data);
|
||||
}
|
||||
|
||||
|
|
|
@ -4556,6 +4556,11 @@ class DboSourceTest extends CakeTestCase {
|
|||
$Article->tablePrefix = 'tbl_';
|
||||
$result = $this->testDb->fullTableName($Article, false);
|
||||
$this->assertEqual($result, 'tbl_articles');
|
||||
|
||||
$Article->useTable = $Article->table = 'with spaces';
|
||||
$Article->tablePrefix = '';
|
||||
$result = $this->testDb->fullTableName($Article);
|
||||
$this->assertEqual($result, '`with spaces`');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue