Project

General

Profile

Actions

Bug #103601

open

Setting l18n_parent to empty results in exception if Debug Preset is used and extension with allowLanguageSynchronization

Added by Sybille Peters 19 days ago. Updated 19 days ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2024-04-11
Due date:
% Done:

0%

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

Description

Versions

  • TYPO3 versions: v11 (latest 11.5 branch and latest release), not reproducible with v13 (latest main) and v12 (latest 12.4 ranch)
  • PHP 8.2
  • test with "Settings" Debug preset

did not test with v12 and v13

Reproduce

Ideally use an extension which adds a field to tt_content which has allowLanguageSynchronization true, e.g.

use extension https://github.com/sypets/sypets_tca_test

'tx_sypets_tca_test_check' => [
        'exclude' => 1,
        'label' => 'Checkbox with allowLanguageSynchronization',
        'config' => [
            'type' => 'check',
            'default' => 0,
            'behaviour' => [
                'allowLanguageSynchronization' => true
            ]
        ]
    ],

(1)

extension is activated, Debug mode

1. create translation page, translate with connected mode
2. edit translated element, set translate origin to empty and save

Exception is thrown, change is not successful

(1/1) #1476107295 TYPO3\CMS\Core\Error\Exception
PHP Warning: Array to string conversion in /var/www/t3coredev11/typo3/sysext/core/Classes/DataHandling/DataHandler.php line 8141

in /var/www/t3coredev11/typo3/sysext/core/Classes/DataHandling/DataHandler.php line 8141

in function compareFieldArrayWithCurrentAndUnset

8137    {
8138        // No NULL values are allowed, this is the regular behaviour.
8139        // Thus, check whether strings are the same or whether integer values are empty ("0" or "").
8140        if (!$allowNull) {
8141            $result = (string)$submittedValue === (string)$storedValue || $storedType === 'int' && (int)$storedValue === (int)$submittedValue;
        // Null values are allowed, but currently there's a real (not NULL) value.
        // Thus, ensure no NULL value was submitted and fallback to the regular behaviour.
        } elseif ($storedValue !== null) {
            $result = (


(2)

extension is activated, Live mode

1. create translation page, translate with connected mode
2. edit translated element, set translate origin to empty and save

Change is successful

check log:

Thu, 11 Apr 2024 09:44:59 +0000 [WARNING] request="c78d853f870f9" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (BE): PHP Warning: Array to string conversion in /var/www/t3coredev11/typo3/sysext/core/Classes/DataHandling/DataHandler.php line 8141 
Thu, 11 Apr 2024 09:44:59 +0000 [WARNING] request="c78d853f870f9" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (BE): PHP Warning: Array to string conversion in /var/www/t3coredev11/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php line 164 
Thu, 11 Apr 2024 09:44:59 +0000 [WARNING] request="c78d853f870f9" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (BE): PHP Warning: Array to string conversion in /var/www/t3coredev11/typo3/sysext/core/Classes/DataHandling/DataHandler.php line 7530 


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #99226: Introduce dbType json for TCA type userClosed2022-11-30

Actions
Actions #1

Updated by Sybille Peters 19 days ago

  • Description updated (diff)
Actions #2

Updated by Sybille Peters 19 days ago

  • Description updated (diff)
Actions #3

Updated by Sybille Peters 19 days ago

  • Description updated (diff)
Actions #4

Updated by Sybille Peters 19 days ago

  • Description updated (diff)
Actions #5

Updated by Sybille Peters 19 days ago

  • Description updated (diff)
Actions #6

Updated by Sybille Peters 19 days ago

Problem seems to have been fixed in v12 with https://review.typo3.org/c/Packages/TYPO3.CMS/+/76535

Anyway, in DataHandler::compareFieldArrayWithCurrentAndUnset there is a discrepancy for l10n_state, the stored value is a JSON string, the new value is an array, when passing this array to isSubmittedValueEqualToStoredValue(), it is cast to string in that function, that is what fails.

Actions #7

Updated by Sybille Peters 19 days ago

  • Related to Feature #99226: Introduce dbType json for TCA type user added
Actions #8

Updated by Sybille Peters 19 days ago

Another problem is that these functions, e.g. isSubmittedValueEqualToStoredValue are very vague about the expected types of the passed variables.

* @param mixed $submittedValue Value that has submitted (e.g. from a backend form)
* @param mixed $storedValue Value that is currently stored in the database
Actions

Also available in: Atom PDF