I am having issue with saving constraint for password policy module.
I am using drupal 8.6.9 and php 7.2 Please help.
Error: Call to a member function getConstraints() on null in Drupal\password_policy\Form\ConstraintEdit->submitForm() (line 145 of /var/www/rheem-dev-admin.thehallway.co/html/modules/password_policy/src/Form/ConstraintEdit.php) #0 [internal function]: Drupal\password_policy\Form\ConstraintEdit->submitForm(Array, Object(Drupal\Core\Form\FormState)) #1 /var/www/rheem-dev-admin.thehallway.co/html/core/lib/Drupal/Core/Form/FormSubmitter.php(111): call_user_func_array(Array, Array) #2 /var/www/rheem-dev-admin.thehallway.co/html/core/lib/Drupal/Core/Form/FormSubmitter.php(51): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState)) #3 /var/www/rheem-dev-admin.thehallway.co/html/core/lib/Drupal/Core/Form/FormBuilder.php(589): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState)) #4 /var/www/rheem-dev-admin.thehallway.co/html/core/lib/Drupal/Core/Form/FormBuilder.php(318): Drupal\Core\Form\FormBuilder->processForm('password_policy...', Array, Object(Drupal\Core\Form\FormState)) #5 /var/www/rheem-dev-admin.thehallway.co/html/core/lib/Drupal/Core/Controller/FormController.php(93): Drupal\Core\Form\FormBuilder->buildForm('password_policy...', Object(Drupal\Core\Form\FormState)) #6 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #7 /var/www/rheem-dev-admin.thehallway.co/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #8 /var/www/rheem-dev-admin.thehallway.co/html/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #9 /var/www/rheem-dev-admin.thehallway.co/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #10 /var/www/rheem-dev-admin.thehallway.co/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #11 /var/www/rheem-dev-admin.thehallway.co/html/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #12 /var/www/rheem-dev-admin.thehallway.co/html/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #13 /var/www/rheem-dev-admin.thehallway.co/html/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #14 /var/www/rheem-dev-admin.thehallway.co/html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #15 /var/www/rheem-dev-admin.thehallway.co/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #16 /var/www/rheem-dev-admin.thehallway.co/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 /var/www/rheem-dev-admin.thehallway.co/html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 /var/www/rheem-dev-admin.thehallway.co/html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #19 /var/www/rheem-dev-admin.thehallway.co/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 /var/www/rheem-dev-admin.thehallway.co/html/core/lib/Drupal/Core/DrupalKernel.php(693): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 /var/www/rheem-dev-admin.thehallway.co/html/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #22 {main}.
Comments
Comment #2
vanlindholm commentedYeah, this happens to me too. Drupal 8.6.9 and php v7.2. Please let me know if you find a workaround ..
Comment #3
rpsuThis applies to 8.x-3.x (current latest) as well. Edit form is not getting temporary values, and cached values in multistep form is empty.
Comment #4
mmenavas commentedPer https://www.drupal.org/node/2935639, I created a patch that replaces references to \Drupal\user\SharedTempStoreFactory with \Drupal\Core\TempStore\SharedTempStoreFactory. This seems to fix the issue in question.
Comment #5
abhisekmazumdarI also faced the issue of saving constraint.
I have tested this patch. it solves the problem of saving the constraint.
Comment #6
rpsuBecause of the change took place in Drupal core 8.5.0, minimum requirement for the core version should be added to the patch.
New patch created with interdiff.
Comment #8
mmenavas commentedIt looks like a recent update in ctools is making a test fail (see issue #2985395).
Comment #9
abhisekmazumdarHi,
The status needs to be changed to Needs Review.
Comment #10
rpsuLooks ok unless the minimum version of ctools should also be set via .info.yml file.
Comment #11
abhisekmazumdarComment #12
travellerconI can confirm this fixes Password Policy for me. I actually applied the patch to the prod version and that works perfectly.
Comment #13
marc.groth commented#8 works perfectly for me too. Thanks!
Comment #14
ghassend8 commentedit doesn't work for me.
Comment #15
ghassend8 commentedit doesn't work for me.
Comment #16
zahor commentedRan into same issue as described. Definitely critical as constraints can't be saved. The patch at #8 applied perfectly and works perfectly
Comment #17
rromore commentedAlso confirming #8 works, thank you!
Comment #18
rajab natshahRe-rolled the patch to work with 3.0-alpha4
or the latest DEV with no restriction
Comment #19
abaier commentedJust tested patch #18 on password_policy 8.x-3.0-alpha4+12-dev. Applied cleanly and let me save constraints for password_policy_length and password_policy_username. Thx!
Comment #20
keanes commentedPatch #18 works perfect!
Comment #21
aohrvetpv commentedThanks for the patches. Is the assertion text change to /password_policy_history/src/Tests/PasswordHistoryTests.php related to this bug fix? If not, it should not be a part of the patch. It looks like to me it is unrelated.
Comment #22
aohrvetpv commentedPatch that removes the unrelated change to a test.
I understand reading the issue comments that that change might be necessary for the tests to pass. If so, I will commit a fix for the tests separately, so we are not combining issues.
Comment #23
aohrvetpv commentedPer https://www.drupal.org/node/45111, I believe the proper issue priority is "Major".
Comment #25
aohrvetpv commentedWill fix the test issue separately.
#22 also needs the change from #6.
Comment #26
aohrvetpv commentedAccidentally set to "Needs review" in last comment.
Comment #27
aohrvetpv commentedTest failure issue from #8: #3054070: testHistoryConstraint fails due to Ctools change
Comment #28
aohrvetpv commentedBoth this issue and #3054070: testHistoryConstraint fails due to Ctools change seem to independently cause test failures. Submitting this combined patch from both issues, to see if committing both fixes independently will get tests fully passing.
Comment #29
mangy.fox commentedFixes the issue for me!
Comment #30
aohrvetpv commentedVersus #22, added the requirement of Drupal >=8.5.0 from #6.
Tests should hopefully pass now, due to fixing #3054070: testHistoryConstraint fails due to Ctools change.
Comment #31
aohrvetpv commentedRerolled patch to commit on latest code.
Comment #33
aohrvetpv commentedThanks to all who contributed to fixing this bug.