Same like the parent issue here also facing the same issue described below

We face this error when we created the workflow and then added the field of the workflow under content type and trying to add the node
we got the same Internal server error
------------------------------------------------------------------------------------------------------------------------------------------------
Recoverable fatal error: Argument 2 passed to Drupal\workflow\Entity\WorkflowManager::getWorkflowTransitionForm() must be an
instance of Drupal\workflow\Entity\string, string given, called in
/var/www/html/pshc/modules/workflow/src/Plugin/Field/FieldWidget/WorkflowDefaultWidget.php on line 98 and defined in
Drupal\workflow\Entity\WorkflowManager::getWorkflowTransitionForm() (line 348 of
/var/www/html/pshc/modules/workflow/src/Entity/WorkflowManager.php) #0 /var/www/html/pshc/core/includes/bootstrap.inc(566):
_drupal_error_handler_real(4096, 'Argument 2 pass...', '/var/www/html/p...', 348, Array)
#1 /var/www/html/pshc/modules/workflow/src/Entity/WorkflowManager.php(348): _drupal_error_handler(4096, 'Argument 2 pass...',
'/var/www/html/p...', 348, Array)
#2 /var/www/html/pshc/modules/workflow/src/Plugin/Field/FieldWidget/WorkflowDefaultWidget.php(98):
Drupal\workflow\Entity\WorkflowManager::getWorkflowTransitionForm(Object(Drupal\node\Entity\Node), 'field_std_hando...')
#3 /var/www/html/pshc/core/lib/Drupal/Core/Field/WidgetBase.php(322):
Drupal\workflow\Plugin\Field\FieldWidget\WorkflowDefaultWidget->formElement(Object(Drupal\Core\Field\FieldItemList), 0, Array,
Array, Object(Drupal\Core\Form\FormState))
#4 /var/www/html/pshc/core/lib/Drupal/Core/Field/WidgetBase.php(189):
Drupal\Core\Field\WidgetBase->formSingleElement(Object(Drupal\Core\Field\FieldItemList), 0, Array, Array,
Object(Drupal\Core\Form\FormState))
#5 /var/www/html/pshc/core/lib/Drupal/Core/Field/WidgetBase.php(104):
Drupal\Core\Field\WidgetBase->formMultipleElements(Object(Drupal\Core\Field\FieldItemList), Array,
Object(Drupal\Core\Form\FormState))
#6 /var/www/html/pshc/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php(168):
Drupal\Core\Field\WidgetBase->form(Object(Drupal\Core\Field\FieldItemList), Array, Object(Drupal\Core\Form\FormState))
#7 /var/www/html/pshc/core/lib/Drupal/Core/Entity/ContentEntityForm.php(122):
Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm(Object(Drupal\node\Entity\Node), Array,
Object(Drupal\Core\Form\FormState))
#8 /var/www/html/pshc/core/modules/node/src/NodeForm.php(113): Drupal\Core\Entity\ContentEntityForm->form(Array,
Object(Drupal\Core\Form\FormState))
#9 /var/www/html/pshc/core/lib/Drupal/Core/Entity/EntityForm.php(117): Drupal\node\NodeForm->form(Array,
Object(Drupal\Core\Form\FormState))
#10 [internal function]: Drupal\Core\Entity\EntityForm->buildForm(Array, Object(Drupal\Core\Form\FormState))
#11 /var/www/html/pshc/core/lib/Drupal/Core/Form/FormBuilder.php(514): call_user_func_array(Array, Array)
#12 /var/www/html/pshc/core/lib/Drupal/Core/Form/FormBuilder.php(271):
Drupal\Core\Form\FormBuilder->retrieveForm('node_std_handov...', Object(Drupal\Core\Form\FormState))
#13 /var/www/html/pshc/core/lib/Drupal/Core/Entity/EntityFormBuilder.php(48):
Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\node\NodeForm), Object(Drupal\Core\Form\FormState))
#14 /var/www/html/pshc/core/modules/node/src/Controller/NodeController.php(113):
Drupal\Core\Entity\EntityFormBuilder->getForm(Object(Drupal\node\Entity\Node))
#15 [internal function]: Drupal\node\Controller\NodeController->add(Object(Drupal\node\Entity\NodeType))
#16 /var/www/html/pshc/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123):
call_user_func_array(Array, Array)
#17 /var/www/html/pshc/core/lib/Drupal/Core/Render/Renderer.php(576):
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#18 /var/www/html/pshc/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124):
Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#19 /var/www/html/pshc/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97):
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#20 [internal function]:
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#21 /var/www/html/pshc/vendor/symfony/http-kernel/HttpKernel.php(153): call_user_func_array(Object(Closure), Array)
#22 /var/www/html/pshc/vendor/symfony/http-kernel/HttpKernel.php(68):
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#23 /var/www/html/pshc/core/lib/Drupal/Core/StackMiddleware/Session.php(57):
Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /var/www/html/pshc/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47):
Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /var/www/html/pshc/core/modules/page_cache/src/StackMiddleware/PageCache.php(99):
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /var/www/html/pshc/core/modules/page_cache/src/StackMiddleware/PageCache.php(78):
Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /var/www/html/pshc/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47):
Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /var/www/html/pshc/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50):
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 /var/www/html/pshc/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23):
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#30 /var/www/html/pshc/core/lib/Drupal/Core/DrupalKernel.php(657):
Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#31 /var/www/html/pshc/index.php(22): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#32 {main}.

Comments

vipul tulse created an issue. See original summary.

vipul tulse’s picture

Assigned: Unassigned » vipul tulse
vipul tulse’s picture

Status: Active » Needs work
vipul tulse’s picture

Issue summary: View changes
vipul tulse’s picture

Status: Needs work » Needs review
StatusFileSize
new1.83 KB

This error is coming because of the Drupal\workflow\Entity\WorkflowManager::getWorkflowTransitionForm() must be an instance
of Drupal\workflow\Entity\string and String type defined while declaring the Interface and defining.

public static function getWorkflowTransitionForm(EntityInterface $entity, string $field_name, array $form_state_additions = []) under the file "workflow/src/Entity/WorkflowManagerInterface.php"

--From above code removed the "string" type

In file "workflow/src/Entity/WorkflowManager.php" did same removed the "string" from defination.

johnv’s picture

Title: Error: Argument 2 passed to Drupal\workflow\Entity\WorkflowManager::getWorkflowTransitionForm() must be an instance of Drupal\workflow\Entity\string, string given » Error: Argument 2 passed to WorkflowManager::getWorkflowTransitionForm() must be an instance of Drupal\workflow\Entity\string

  • johnv committed 71b8d65 on 8.x-1.x authored by vipul tulse
    Issue #2934287 by vipul tulse: Error: Argument 2 passed to...
johnv’s picture

Version: 8.x-1.x-dev » 8.x-1.0
Status: Needs review » Fixed

Committed. Thanks.

deepakvishnu’s picture

Hi Vipul,

The error occurred when the PHP version is < 7.0, hence upgrading PHP version to 7.1 will also work fine. Patch which is available is not working.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

vipul tulse’s picture

But I'm using the PHP 7.1 with my patch working fine for me.

The module should be run on every version of PHP which Drupal 8 supports, we can not force every user to upgrade their PHP version for only using this module

sassafrass’s picture

I am using Workflow successfully with Drupal 8.4.3 and PHP 5.6.32. However, when I try to enable Workflow module on a site with Drupal 8.3.7 and PHP 5.6.32, I get this error. I haven't tried the patch yet. Will report back when I do.

Reporting back: Patch fixes the error. Thanks!