pixelant / pxa_survey

17 stars 9 forks source link

Translation for finished surveys failing #23

Closed sternenvogel closed 2 years ago

sternenvogel commented 5 years ago

Extension version 1.4.1, TYPO3 version 9.5.5

Problem: I have a survey with translation. In the plugin on the translated page I selected the translated survey.

How to reproduce:

  1. Create a survey with a translation.
  2. Create a page with translation and in the translated page, insert the survey plugin "Simple Survey" with option "Show survey questions" and option "Allow user to take part in survey more than once" NOT set.
  3. Now submit a survey in the frontend and call the survey again.
  4. Message "Oops, an error occurred! Code: 201905231354111293fe43" occurs.

Details: (1/1) #1217839467 TYPO3\CMS\Extbase\Mvc\Exception\InfiniteLoopException Could not ultimately dispatch the request after 101 iterations. Most probably, a @TYPO3\CMS\Extbase\Annotation\IgnoreValidation annotation is missing on re-displaying a form with validation errors.

in /.../typo3/sysext/extbase/Classes/Mvc/Dispatcher.php line 69

    {
        $dispatchLoopCount = 0;
        while (!$request->isDispatched()) {
            if ($dispatchLoopCount++ > 99) {
                throw new \TYPO3\CMS\Extbase\Mvc\Exception\InfiniteLoopException('Could not ultimately dispatch the request after ' . $dispatchLoopCount . ' iterations. Most probably, a @' . \TYPO3\CMS\Extbase\Annotation\IgnoreValidation::class . ' annotation is missing on re-displaying a form with validation errors.', 1217839467);
            }

Cause: The comparison on https://github.com/pixelant/pxa_survey/blob/385191d33baa12ad666492ea8540945cff120ca4/Classes/Controller/SurveyController.php#L125

fails, because the plugin ($this->settings['survey']) has the uid of the translated record and survey object ($survey->getUid()) has the uid of the original language. This triggers an infinite loop between showAction() and finishAction().

Possible solution: See https://github.com/pixelant/pxa_survey/pull/24/files#diff-9fa9187aa49c3aa7e1c646e231ac934e Maybe not the best, but working.

MattiasNilsson commented 2 years ago

https://github.com/pixelant/pxa_survey/releases/tag/v2.0.0