- Issue created by @LuongGiap
- ๐ฎ๐ณIndia kbk1992 Hyderabad
bharath-kondeti โ made their first commit to this issueโs fork.
- @luonggiap opened merge request.
- First commit to issue fork.
- Status changed to Needs review
about 1 year ago 9:00am 14 June 2023 - Status changed to Active
about 1 year ago 9:58am 14 June 2023 Hi,
I have the same bug.
If I change my code with your commit 21899973
It create new error on line 345 private function isResponseCorrect(string $response, string $crp, bool $caseSensitive): bool {...TypeError : Drupal\opigno_h5p\TypeProcessors\FillInProcessor::isResponseCorrect(): Argument #2 ($crp) must be of type string, array given, called in /app/web/modules/contrib/opigno_module/ActivityTypes/opigno_h5p/src/TypeProcessors/FillInProcessor.php on line 255 dans Drupal\opigno_h5p\TypeProcessors\FillInProcessor->isResponseCorrect() (/app/web/modules/contrib/opigno_module/ActivityTypes/opigno_h5p/src/TypeProcessors/FillInProcessor.php ligne 335)
I try to fix it, but next I have same error in $singleCRP.
- Status changed to Needs review
11 months ago 8:08am 2 August 2023 - ๐จ๐ญSwitzerland Berdir Switzerland
The patch works, but knowing nothing about opigno internals, this seems very strange. isResponseCorrect() has $crp as string, the value that is being worked with seems to be a string at least in some cases and then the implementation inside clearly also expects it to be an array or it wouldn't call array_map() on it.
So instead of converting twice, maybe $crp should be set to array and we should ensure we always pass in an array? The function is private and only used in one place, so should be fine to change.
Setting to needs review to make it clear that there is a patch here and get feedback from the maintainers.
- ๐จ๐ญSwitzerland Berdir Switzerland
Turns out the patch doesn't work for us, because it only converts it to an array if case sensitivity is off, but the is_array() below still expects it to be an array.
Here's patch that does what I suggested and changes the type to array, that seems to just work for us in this one case, will require more testing.
I have the same exact bug with a quiz when updating Opigno from 3.0.9 to 3.1.0.
The error occurred specifically on a Drag Text question:
This was resolved with the patch provided in comment #12 by Berdir. I did not try any other patches.
- ๐ซ๐ทFrance G4MBINI Bรจgles
Hi,
I encounter same kind of issue with Flashcards (https://h5p.org/tutorial-flashcards)
The website encountered an unexpected error. Please try again later. TypeError: Drupal\opigno_h5p\TypeProcessors\FillInProcessor::isResponseCorrect(): Argument #2 ($crp) must be of type string, array given, called in /app/web/modules/contrib/opigno_module/ActivityTypes/opigno_h5p/src/TypeProcessors/FillInProcessor.php on line 255 in Drupal\opigno_h5p\TypeProcessors\FillInProcessor->isResponseCorrect() (line 335 of modules/contrib/opigno_module/ActivityTypes/opigno_h5p/src/TypeProcessors/FillInProcessor.php). Drupal\opigno_h5p\TypeProcessors\FillInProcessor->isResponseCorrect('Romain', Array, ) (Line: 255) Drupal\opigno_h5p\TypeProcessors\FillInProcessor->getPlaceholderReplacements(Array, Array, ) (Line: 218) Drupal\opigno_h5p\TypeProcessors\FillInProcessor->buildReportOutput('Respond to FCWhat's your name ? __________', Array, Array, ) (Line: 72) Drupal\opigno_h5p\TypeProcessors\FillInProcessor->generateHtml('Respond to FCWhat's your name ? __________', Array, 'Romain', Object, NULL) (Line: 66) Drupal\opigno_h5p\TypeProcessors\TypeProcessor->generateReport(Object, , ) (Line: 118) Drupal\opigno_h5p\H5PReport->generateReport(Object) (Line: 78) template_preprocess_opigno_user_result_item__opigno_h5p(Array, 'opigno_user_result_item', Array) call_user_func_array('template_preprocess_opigno_user_result_item__opigno_h5p', Array) (Line: 287) Drupal\Core\Theme\ThemeManager->render('opigno_user_result_item', Array) (Line: 433) Drupal\Core\Render\Renderer->doRender(Array) (Line: 446) Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204) Drupal\Core\Render\Renderer->render(Array, ) (Line: 242) Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 580) Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 243) Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 132) Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90) Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object) call_user_func(Array, Object, 'kernel.view', Object) (Line: 142) Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 174) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106) Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23) Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
- ๐บ๐ธUnited States jwjoshuawalker San Diego
Just want to chime in and say we were experiencing this issue as well.
Very serious problem! Users would go through all the steps of a very lengthy test and at the end it wouldn't record the score in the
opigno_learning_path_achievements
table as 'completed', but left it stuck in a 'pending' state.
(It also caused it to fail setting the completed date in that table).The proposed patch is simple, has anyone from Opigno seen this thread?