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

saifullah.akber created an issue. See original summary.

vanlindholm’s picture

Yeah, this happens to me too. Drupal 8.6.9 and php v7.2. Please let me know if you find a workaround ..

rpsu’s picture

Version: 8.x-3.0-alpha4 » 8.x-3.x-dev

This 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.

mmenavas’s picture

Per 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.

abhisekmazumdar’s picture

Status: Active » Reviewed & tested by the community

I also faced the issue of saving constraint.
I have tested this patch. it solves the problem of saving the constraint.

rpsu’s picture

StatusFileSize
new2.56 KB
new346 bytes

Because 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.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 6: password_policy-use-core-temp-store-3032549-6.patch, failed testing. View results

mmenavas’s picture

It looks like a recent update in ctools is making a test fail (see issue #2985395).

abhisekmazumdar’s picture

Status: Needs work » Needs review

Hi,
The status needs to be changed to Needs Review.

rpsu’s picture

Status: Needs review » Reviewed & tested by the community

Looks ok unless the minimum version of ctools should also be set via .info.yml file.

travellercon’s picture

I can confirm this fixes Password Policy for me. I actually applied the patch to the prod version and that works perfectly.

marc.groth’s picture

#8 works perfectly for me too. Thanks!

ghassend8’s picture

it doesn't work for me.

ghassend8’s picture

it doesn't work for me.

zahor’s picture

Ran into same issue as described. Definitely critical as constraints can't be saved. The patch at #8 applied perfectly and works perfectly

rromore’s picture

Also confirming #8 works, thank you!

rajab natshah’s picture

StatusFileSize
new2.52 KB

Re-rolled the patch to work with 3.0-alpha4

"drupal/password_policy": "3.0-alpha4",

or the latest DEV with no restriction

abaier’s picture

Just 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!

keanes’s picture

Patch #18 works perfect!

aohrvetpv’s picture

Status: Reviewed & tested by the community » Needs work

Thanks 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.

aohrvetpv’s picture

Status: Needs work » Needs review
StatusFileSize
new2.22 KB

Patch 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.

aohrvetpv’s picture

Priority: Critical » Major

Per https://www.drupal.org/node/45111, I believe the proper issue priority is "Major".

Status: Needs review » Needs work
aohrvetpv’s picture

Status: Needs work » Needs review

Will fix the test issue separately.

#22 also needs the change from #6.

aohrvetpv’s picture

Status: Needs review » Needs work

Accidentally set to "Needs review" in last comment.

aohrvetpv’s picture

aohrvetpv’s picture

Both 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.

mangy.fox’s picture

Fixes the issue for me!

aohrvetpv’s picture

Versus #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.

aohrvetpv’s picture

Rerolled patch to commit on latest code.

  • AohRveTPV committed 5f036e0 on 8.x-3.x authored by mmenavas
    Issue #3032549 by AohRveTPV, mmenavas, RajabNatshah: Password policy...
aohrvetpv’s picture

Status: Needs review » Fixed

Thanks to all who contributed to fixing this bug.

Status: Fixed » Closed (fixed)

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