extension_builder icon indicating copy to clipboard operation
extension_builder copied to clipboard

[BUG] 🐛 saving fails with error message

Open DavidBruchmann opened this issue 2 years ago • 1 comments

Describe the bug Saving an extension fails with the error message that a key is not defined. This is due to missing check in the ConfigurationManager. I'm not sure if the scenario is important:

I've created an extension and overwrote it several times but without enabled round-trip-mode (this was no fault but my intention, as the reoundtrip mode has some own issues in different locations).

Expected behavior That saving can happen without error message and interruption.

TYPO3 Version v11

Extension Builder Version: v11

Additional context The attached patch adds a variable-check. Sorry, upload doesn't work here, so as code:

--- Classes/Configuration/ExtensionBuilderConfigurationManager.php.original	2023-12-31 22:31:45.519193871 +0700
+++ Classes/Configuration/ExtensionBuilderConfigurationManager.php	2023-12-31 22:31:43.079104601 +0700
@@ -428,7 +428,8 @@
             return $result;
         }
 
-        if ($modules[$supposedModuleIndex]['value']['relationGroup']['relations'][$supposedRelationIndex]['uid'] === $uid) {
+        if (!empty($modules[$supposedModuleIndex]['value']['relationGroup']['relations'][$supposedRelationIndex]['uid'])
+            && $modules[$supposedModuleIndex]['value']['relationGroup']['relations'][$supposedRelationIndex]['uid'] === $uid) {
             $result['terminal'] = 'relationWire_' . $supposedRelationIndex;
             return $result;
         }

DavidBruchmann avatar Dec 31 '23 15:12 DavidBruchmann

Here is another fix, actually I don't remember the situation very clear, but it happens on saving too that an error is thrown:

--- Classes/Controller/BuilderModuleController.php	2023-10-18 14:38:08.000000000 +0700
+++ Classes/Controller/BuilderModuleController.php.patched	2023-12-31 23:50:28.286423518 +0700
@@ -554,13 +554,14 @@
                     throw $e;
                 }
             } else {
-                if (!is_array($extensionSettings['ignoreWarnings'])
+                if (empty($extensionSettings['ignoreWarnings'])
+                    || !is_array($extensionSettings['ignoreWarnings'])
                     || !in_array(ExtensionValidator::EXTENSION_DIR_EXISTS, $extensionSettings['ignoreWarnings'])
                 ) {
                     $confirmationRequired = $this->handleValidationWarnings([
                         new ExtensionException(
                             "This action will overwrite previously saved content!\n(Enable the roundtrip feature to avoid this warning).",
-                            ExtensionValidator::EXTENSION_DIR_EXISTS
+                                               ExtensionValidator::EXTENSION_DIR_EXISTS
                         )
                     ]);
                     if (!empty($confirmationRequired)) {

DavidBruchmann avatar Dec 31 '23 18:12 DavidBruchmann