Project

General

Profile

Actions

Bug #104510

open

Incorrect integer value: '' when creating workspace overlay with inline MM field

Added by Christian Weiske 17 days ago. Updated 14 days ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
DataHandler aka TCEmain
Target version:
-
Start date:
2024-07-31
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #95513: SQL error: 'Incorrect integer value: '' for column 'grade' at row 1'Closed2021-10-07

Actions
Actions #1

Updated by Christian Weiske 17 days ago

  • Related to Bug #95513: SQL error: 'Incorrect integer value: '' for column 'grade' at row 1' added
Actions #2

Updated by Christian Weiske 16 days ago

Changing the SQL mode in the database connection does help:

'initCommands' => 'SET sql_mode=\'\';',

Actions #3

Updated by Garvin Hicking 14 days ago

  • Status changed from New to Needs Feedback

I believe this is fixed in v13 due to the TCA evaluation changes. Would you be willing to try to reproduce the issue in v13 by chance? :-)

Actions

Also available in: Atom PDF