Bug #103601
openSetting l18n_parent to empty results in exception if Debug Preset is used and extension with allowLanguageSynchronization
0%
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
Updated by Sybille Peters 7 months 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.
Updated by Sybille Peters 7 months ago
- Related to Feature #99226: Introduce dbType json for TCA type user added
Updated by Sybille Peters 7 months 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