diff --git a/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php b/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php index 3e82f38a7f1..132471d1f54 100644 --- a/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php @@ -269,7 +269,7 @@ protected function _getPortableTableColumnList($table, $database, $tableColumns) protected function _getPortableTableColumnDefinition($tableColumn) { $parts = explode('(', $tableColumn['type']); - $tableColumn['type'] = $parts[0]; + $tableColumn['type'] = trim($parts[0]); if (isset($parts[1])) { $length = trim($parts[1], ')'); $tableColumn['length'] = $length; diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php index dd03a0f9877..8ad8538985e 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php @@ -3,6 +3,7 @@ namespace Doctrine\Tests\DBAL\Functional\Schema; use Doctrine\DBAL\Schema; +use Doctrine\DBAL\Types\Type; class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase { @@ -156,6 +157,34 @@ public function testNonDefaultPKOrder() $this->assertEquals(array('other_id', 'id'), array_map('strtolower', $tableIndexes['primary']->getColumns())); } + /** + * @group DBAL-1779 + */ + public function testListTableColumnsWithWhitespacesInTypeDeclarations() + { + $sql = <<_conn->executeQuery($sql); + + $columns = $this->_sm->listTableColumns('dbal_1779'); + + $this->assertCount(2, $columns); + + $this->assertArrayHasKey('foo', $columns); + $this->assertArrayHasKey('bar', $columns); + + $this->assertSame(Type::getType(Type::STRING), $columns['foo']->getType()); + $this->assertSame(Type::getType(Type::TEXT), $columns['bar']->getType()); + + $this->assertSame(64, $columns['foo']->getLength()); + $this->assertSame(100, $columns['bar']->getLength()); + } + /** * @dataProvider getDiffListIntegerAutoincrementTableColumnsData * @group DBAL-924