Project

General

Profile

Actions

Bug #88426

closed

Extension Configuration: IDs duplicated and incorrect checkbox handling for same config key in different extensions

Added by Jonas Eberle over 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
System/Bootstrap/Configuration
Target version:
-
Start date:
2019-05-23
Due date:
% Done:

100%

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

Description

When saving an extension config (Settings › Extension Configuration) that consists only of checkboxes and none is checked you get a warning.
Depending on your exception settings that can trigger an exception which prevents the settings form being written.

AJAX:
/typo3/install.php?install[controller]=settings&install[context]=backend

"TYPO3_MODE":"BE","exception":"TYPO3\\CMS\\Core\\Error\\Exception: PHP Warning: Invalid argument supplied for foreach() in \/var\/www\/html\/webroot\/web\/typo3\/sysext\/install\/Classes\/Controller\/SettingsController.php line 387 in \/var\/www\/html\/webroot\/web\/typo3\/sysext\/core\/Classes\/Error\/ErrorHandler.php:116

Stack trace:
#0 \/var\/www\/html\/webroot\/web\/typo3\/sysext\/install\/Classes\/Controller\/SettingsController.php(387): TYPO3\\CMS\\Core\\Error\\ErrorHandler->handleError(2, 'Invalid argumen...', '\/var\/www\/html\/w...', 387, Array)
#1 \/var\/www\/html\/webroot\/web\/typo3\/sysext\/install\/Classes\/Http\/RequestHandler.php(205): TYPO3\\CMS\\Install\\Controller\\SettingsController->extensionConfigurationWriteAction(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))
#2 \/var\/www\/html\/webroot\/web\/typo3\/sysext\/install\/Classes\/Http\/Application.php(65): TYPO3\\CMS\\Install\\Http\\RequestHandler->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))
#3 \/var\/www\/html\/webroot\/web\/typo3\/sysext\/core\/Classes\/Http\/AbstractApplication.php(110): TYPO3\\CMS\\Install\\Http\\Application->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))
#4 \/var\/www\/html\/webroot\/web\/typo3\/install.php(104): TYPO3\\CMS\\Core\\Http\\AbstractApplication->run()
#5 \/var\/www\/html\/webroot\/web\/typo3\/install.php(105): {closure}()
#6 {main}" 
Actions #1

Updated by Guido Schmechel over 5 years ago

Do you have an example config?

I see "extensionmanager" as example with two checkboxes. Both unchecked gives me this result:

array(2 items)
automaticInstallation => '0' (1 chars)
offlineMode => '0' (1 chars)

# cat=basic/enable; type=boolean; label=LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:config.automaticInstallation
automaticInstallation = 1

# cat=basic/enable; type=boolean; label=LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:config.offlineMode
offlineMode = 0

Actions #2

Updated by Jonas Eberle over 5 years ago

You are right, there is no error with "extensionmanager"...

But with this in ext_conf_template.txt in a custom extenstion I get the error:

# cat=basic/enable; type=boolean; label=Enable debug logging
isDebug = 0

I'll debug what's going on there.

Actions #3

Updated by Jonas Eberle over 5 years ago

It is triggered if (another extension) uses the same setting key.

In that case only the first occurence of the checkbox gets the value=0 hidden-field prepended.
Also the id is duplicated.

This is the output:

<form ... data-extensionkey="...extension1...">
  ...
  <input type="hidden" name="isDebug" value="0">
  <input type="checkbox" name="isDebug" value="1" id="em-isDebug" checked="checked">
  ...
</form>
...
<form ... data-extensionkey="...extension2...">
  ...
  <input type="checkbox" name="isDebug" value="1" id="em-isDebug" checked="checked">
  ...
</form>

I'll try to provide a patch.

Actions #4

Updated by Jonas Eberle over 5 years ago

  • Subject changed from Extension Configuration: Warning on save when all checkboxes unchecked to Extension Configuration: IDs duplicated and incorrect checkbox handling for same config key in different extensions
Actions #5

Updated by Gerrit Code Review over 5 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60831

Actions #6

Updated by Gerrit Code Review over 5 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60831

Actions #7

Updated by Gerrit Code Review over 5 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60831

Actions #8

Updated by Jonas Eberle over 5 years ago

This can be reproduced by duplicating any ext_conf_template.txt that contains a checkbox from one extension to another.

Actions #9

Updated by Gerrit Code Review over 5 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60831

Actions #10

Updated by Gerrit Code Review over 5 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60831

Actions #11

Updated by Anonymous over 5 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #12

Updated by Benni Mack almost 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF