Reverted strict comparison back to loose because of a new regression

parent 9d382e69
......@@ -435,7 +435,7 @@ class Comparator
// Null values need to be checked additionally as they tell whether to create or drop a default value.
// null != 0, null != false, null != '' etc. This affects platform's table alteration SQL generation.
if (($properties1['default'] === null) !== ($properties2['default'] === null)
|| (string) $properties1['default'] !== (string) $properties2['default']) {
|| $properties1['default'] != $properties2['default']) {
$changedProperties[] = 'default';
}
......
......@@ -58,4 +58,9 @@
<exclude-pattern>tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php</exclude-pattern>
<exclude-pattern>tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php</exclude-pattern>
</rule>
<!-- see https://github.com/doctrine/dbal/issues/3377 -->
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowEqualOperators.DisallowedNotEqualOperator">
<exclude-pattern>lib/Doctrine/DBAL/Schema/Comparator.php</exclude-pattern>
</rule>
</ruleset>
......@@ -25,15 +25,31 @@ class ComparatorTest extends DbalFunctionalTestCase
$this->comparator = new Comparator();
}
public function testDefaultValueComparison()
/**
* @param mixed $value
*
* @dataProvider defaultValueProvider
*/
public function testDefaultValueComparison(string $type, $value) : void
{
$table = new Table('default_value');
$table->addColumn('id', 'integer', ['default' => 1]);
$table->addColumn('test', $type, ['default' => $value]);
$this->schemaManager->createTable($table);
$this->schemaManager->dropAndCreateTable($table);
$onlineTable = $this->schemaManager->listTableDetails('default_value');
self::assertFalse($this->comparator->diffTable($table, $onlineTable));
}
/**
* @return mixed[][]
*/
public static function defaultValueProvider() : iterable
{
return [
['integer', 1],
['boolean', false],
];
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment