[TYPO3-core] RFC #8542: Cannot create page with Mysl in strict mode (STRICT_TRANS_TABLES)
Martin Kutschker
martin.kutschker-n0spam at no5pam-blackbox.net
Thu May 29 11:43:34 CEST 2008
Martin Kutschker schrieb:
> Hi!
>
> This is a patch request for 4.2 and trunk.
>
> Problem: When I want to create a page I get an Mysql error saying that
> it has an invalid value for an integer field. The problem is that
> "storage_pid" is when not set initially an empty string. It seems that I
> get only default values in strict mode for NULL, but no type conversion
> from empty string to 0 occurs.
>
> Solution: Make the conversion in TCEmain if necessary. A possible
> different solution would be to use 0 as TCA default for group fields
> (internal_type "db"), but I think it is more proper to make the
> conversion in TCEmain if necessary for all such occurrences.
After further analysis I have found that the problem is a bit odd. THe
TCA has the type "group"/"db" which uses an integer when uses as "MM".
But this is not the case for "storage_pid". What we have here is a field
that has "maxitems" of 1 and "prepend_tname" = 0, which means that there
will only be an integer stored and not a comma separated list of
strings. TYPO3 copes with the fact that Mysql will turn an empty
list/string into 0. This is fine, but a bit of a hack as a group with
exactly one item isn't a group at all.
A "group"/"db" field that is no "MM" would usually be a VARCHAR, but
because of the special constraints it may be an INT. What to do now?
Change the fields in the Core to VARCHAR or make sure that all fields
with such a setup write 0 to the DB? The latter would fix all
occurrences in the Core an extensions that follow the (bad?) example of
"storage_pid".
I have fixed this experimentally in
t3lib_TCEmain::checkValue_group_select_processDBdata(), but it may make
sense to return an array with a 0 element in
t3lib_loadDBGroup::getValueArray(). Now the function returns an empty
array, which is fine for all setups except this one.
Masi
More information about the TYPO3-team-core
mailing list