Bug #88426

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

Added by Jonas Eberle 5 months ago. Updated 4 months ago.

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

100%

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}" 

Associated revisions

Revision 7fdb0f0b (diff)
Added by Jonas Eberle 4 months ago

[BUGFIX] Allow same configuration key in multiple extensions

Fix two issues in the extension configuration tool if more than one
extension is using the same configuration key:

  • Remove duplicate HTML IDs in extension configuration tool
  • Correctly add hidden fields with value=0 for checkboxes within every
    sub-<form>, not only on first occurence (first extension) of any given
    configuration key

Resolves: #88426
Releases: master, 9.5
Change-Id: Ifbdb3b495443aa5521a4b5265ae3c29c2bc222b8
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60831
Tested-by: TYPO3com <>
Tested-by: Guido Schmechel <>
Tested-by: Benni Mack <>
Reviewed-by: Guido Schmechel <>
Reviewed-by: Benni Mack <>

Revision 4d1c1604 (diff)
Added by Jonas Eberle 4 months ago

[BUGFIX] Allow same configuration key in multiple extensions

Fix two issues in the extension configuration tool if more than one
extension is using the same configuration key:

  • Remove duplicate HTML IDs in extension configuration tool
  • Correctly add hidden fields with value=0 for checkboxes within every
    sub-<form>, not only on first occurence (first extension) of any given
    configuration key

Resolves: #88426
Releases: master, 9.5
Change-Id: Ifbdb3b495443aa5521a4b5265ae3c29c2bc222b8
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60938
Tested-by: Jonas Eberle <>
Tested-by: TYPO3com <>
Tested-by: Benni Mack <>
Reviewed-by: Benni Mack <>

History

#1 Updated by Guido Schmechel 5 months 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

#2 Updated by Jonas Eberle 5 months 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.

#3 Updated by Jonas Eberle 5 months 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.

#4 Updated by Jonas Eberle 5 months 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

#5 Updated by Gerrit Code Review 5 months 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

#6 Updated by Gerrit Code Review 5 months 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

#7 Updated by Gerrit Code Review 5 months 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

#8 Updated by Jonas Eberle 5 months ago

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

#9 Updated by Gerrit Code Review 5 months 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

#10 Updated by Gerrit Code Review 5 months 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

#11 Updated by Anonymous 4 months ago

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

Also available in: Atom PDF