Affected version(s)
4.8.4
Description
I updated a Contao 4.4 to 4.8.4 and then I got some trouble in the installer.
Unfortunately, I just found the error after some debugging because the log won't tell you the reason.
In a custom DCA we had some legacy sql definition (the value was "INTEGER" - without any whitespaces).
Finally I found the reason, that $def can be null, if the string $sql contains no whitespace here:
https://github.com/contao/contao/blob/2635f5a043c1308fd3fe1352b4b9de7665206cc8/core-bundle/src/Doctrine/Schema/DcaSchemaProvider.php#L157
Afterwards you will get an exception, because preg_match won't accept the given null of $def
https://github.com/contao/contao/blob/2635f5a043c1308fd3fe1352b4b9de7665206cc8/core-bundle/src/Doctrine/Schema/DcaSchemaProvider.php#L176
How to reproduce
Set the following definition in a DCA for any field:
'sql' => "INTEGER"
In the meantime I replaced the value in the DCA to: int(11) DEFAULT NULL, which fixed of course the problem for me :-)
I guess there should be a explaining exception if $def is null.
I guess there should be a explaining exception if
$defisnull.
Agreed. 馃槂
Or we simply accept without a space as well? If that worked before, it should still work now?
Fixed in 6e8e97568f58843f6eb2026d9a465671c308625e.
Most helpful comment
Or we simply accept without a space as well? If that worked before, it should still work now?