Skip to content

Commit 8ecad2c

Browse files
committed
[BUGFIX] Fix possible exception with additional validators or spam prevention methods
If someone extends powermail with own validators and is using "show confirmation page" it could happen that the error 'Exception while property mapping at property path "": It is not allowed to map property "answers". You need to use $propertyMappingConfiguration->allowProperties('answers') to enable mapping of this property.' pops up. Problem is basicly because createAction with its validators forwarded the request to confirmationAction with the same validators
1 parent f13ae7b commit 8ecad2c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Classes/Controller/FormController.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,22 @@ protected function forwardIfFormParamsDoNotMatchForOptinConfirm(Mail $mail = nul
455455
}
456456
}
457457

458+
/**
459+
* Always forward to formAction if a validation fails. Otherwise it could happen that when
460+
* a validator for createAction fails, confirmationAction is called (if function is turned on) and same validators
461+
* are firing again
462+
*
463+
* @return void
464+
* @throws StopActionException
465+
*/
466+
protected function forwardToReferringRequest()
467+
{
468+
$originalRequest = clone $this->request;
469+
$this->request->setOriginalRequest($originalRequest);
470+
$this->request->setOriginalRequestMappingResults($this->arguments->validate());
471+
$this->forward('form');
472+
}
473+
458474
/**
459475
* Decide if the mail object should be persisted or not
460476
* persist if

0 commit comments

Comments
 (0)