Support from Acquia helps fund testing for Drupal Acquia logo

Comments

miro_dietiker created an issue. See original summary.

Ginovski’s picture

Assigned: Unassigned » Ginovski
Status: Active » Needs review
FileSize
1.45 KB

Added method and exists check

Status: Needs review » Needs work

The last submitted patch, 2: fatal_error_when-2824981-2.patch, failed testing.

Ginovski’s picture

Status: Needs work » Needs review
FileSize
3.04 KB

Added test method and moved checks and function in DelivererConfigurationForm.

mbovan’s picture

Status: Needs review » Needs work
+++ b/src/Form/DelivererConfigurationForm.php
@@ -38,6 +52,18 @@ class DelivererConfigurationForm extends PluginConfigurationForm {
+    if ($this->delivererExists($form_state->getValue('label'))) {
+      $form_state->setErrorByName('label', $this->t('A plugin with label @label already exists.', ['@label' => $form_state->getValue('label')]));
+    }

Not sure if we should disable creating deliverers with the same name. It should not cause any problems since it's not a primary key.

Also, test-only patch helps to reveal a bug/fatal error in such cases.

Ginovski’s picture

1.Removed delivererExists function, only checking the id.

The last submitted patch, 6: fatal_error_when-2824981-6-test-only.patch, failed testing.

mbovan’s picture

I'm wondering when this stopped working... There is a validation added on #machine_name element in PluginConfigurationForm that should prevent those cases. Could be a core bug or so.

+++ b/src/Form/DelivererConfigurationForm.php
@@ -38,6 +38,15 @@ class DelivererConfigurationForm extends PluginConfigurationForm {
+      $form_state->setErrorByName('id', $this->t('A plugin with @id Machine-readable name already exists.', ['@id' => $form_state->getValue('id')]));

Maybe we can remove "Machine-readable name" from the sentence.

Ginovski’s picture

1.Removed 'machine-readable name' from message.

Status: Needs review » Needs work

The last submitted patch, 9: fatal_error_when-2824981-10.patch, failed testing.

Ginovski’s picture

Status: Needs work » Needs review
FileSize
679 bytes
2.01 KB

1. Forgot to update the test. (correct patch here)

Ginovski’s picture

Removed unrelated change.

Ginovski’s picture

Adding test-only patch and the patch with the validation method.

The last submitted patch, 13: fatal_error_when-2824981-12-test-only.patch, failed testing.

toncic’s picture

Status: Needs review » Reviewed & tested by the community

Is it much better now ;) only, be careful with uploading patch. Check patch before uploading.

miro_dietiker’s picture

Status: Reviewed & tested by the community » Fixed

Committing, but we should make sure we report the core bug if it is one.

mbovan’s picture

We need some more investigation (examples) to confirm it's a core bug, but we're getting that way, since this issue occurs in Collect as well #2826323: Fatal error when creating collect model with existing name.

Ginovski’s picture

Status: Fixed » Needs review
FileSize
1.81 KB

There is a bug with this patch in the validate function. When editing a deliverer and trying to save it, there is a message that reports there is a deliverer with the same machine name.
#2557299: Any AJAX call disregards machine name verification when AJAX is used and leads to a fatal error This issue covers the fatal error, and I guess when it is fixed, there will be no fatal error reported anymore.
I suggest that we revert the patch and wait for the core issue to be fixed instead.
Here is a patch removing the code from this issue.

miro_dietiker’s picture

Status: Needs review » Needs work

Committed this. Still open is the confirmation that the other issue really solves the problem.
And we should make the other issue happen. Please help doing so.