New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cast boolean to integer in DC_Table::copy
#6473
Conversation
Note: our |
Did you test if the |
|
@ausi oh, or do you mean if somebody uses Contao\Database::getInstance()
->prepare("INSERT INTO tl_content %s")
->set(['invisible' => false, …])
->execute()
; which previsouly would have, by chance, inserted |
Yes, not sure if we would even need to support the custom query with a |
@ausi you are right, this would then save I'll see if we can fix this particular issue in |
This reverts commit 87f657d.
Another way to fix this would be to change contao/core-bundle/src/Resources/contao/library/Contao/Widget.php Lines 1501 to 1509 in b64c6f4
to - if (\in_array($sql['type'], array(Types::BIGINT, Types::DECIMAL, Types::INTEGER, Types::SMALLINT, Types::FLOAT)))
+ if (\in_array($sql['type'], array(Types::BIGINT, Types::DECIMAL, Types::INTEGER, Types::SMALLINT, Types::FLOAT, Types::BOOLEAN)))
{
return 0;
}
-
- if ($sql['type'] === Types::BOOLEAN)
- {
- return false;
- } But this may have unintended consequences so I think we should fix this case by case instead. The current version of this PR fixes this for the |
Statement::query
DC_Table::copy
Thank you @fritzmg. |
Suppose you have the following DCA adjustment within Contao 4.13:
If you then copy a content element, the following error will occur:
This PR would fix this - by backporting a change we introduced in 94c2feb.
Note: checkbox fields with
boolean
database types are supported since Contao4.9.11
.