#104510Incorrect integer value: '' when creating workspace overlay with inline MM field
Description
When editing the page title of a page in a workspace, I get errors:
> 2: SQL error: ‘Incorrect integer value: ‘’ for column `dbname`.`pages`.`tx_social_comments` at row 1’ (pages:NEW66aa0c9f05a82297360389)
> 1: Could not be edited in offline workspace in the branch where found (failure state: ‘Online record was not in a workspace!’). Auto-creation of version failed!
The tx_social_comments fields is added by my own extension that overrides the pages TCA:
'tx_social_comments' => [
'label' => 'Comments',
'config' => [
'type' => 'inline',
'allowed' => 'tx_social_domain_model_comment',
'foreign_table' => 'tx_social_domain_model_comment',
'MM' => 'tx_social_parent_comment_mm',
'MM_opposite_field' => 'parent',
'MM_insert_fields' => [
'tablenames' => 'pages'
],
'MM_match_fields' => [
'tablenames' => 'pages'
],
]
],
The SQL definition does not allow NULL values and forces the integer type:
CREATE TABLE pages (
tx_social_comments int(11) NOT NULL DEFAULT '0'
);
This happens because the MySQL server is running in strict mode.
Now when switching to a workspace and editing the page title, an overlay record is created.
Unfortunately, the value for tx_social_comments is determined to be an empty string instead of 0 although this MM columns contain the number of MM records.
The code path in datahandler is
copyRecord_raw
-> copyRecord_procBasedOnFieldType
-> copyRecord_processManyToMany
-> insertNewCopyVersion
-> checkValue_SW
-> checkValueForInline
checkValueForInline returns an empty array when it determines the incoming value is empty.
Configuring a TCA default => 0 and eval => int property does not help.
I report this for TYPO3 v11.5.38 but the code of checkValueForInline did not change up to TYPO3 v13.2, so I assume it is still there.