Problem/Motivation

TypeError: Drupal\Core\Form\FormState::setRedirectUrl(): Argument #1 ($url) must be of type Drupal\Core\Url, null given, called in C:\wamp64\www\my_learning_site\web\modules\Contrib\customerror\customerror.module on line 101 in Drupal\Core\Form\FormState->setRedirectUrl() (line 1034 of core\lib\Drupal\Core\Form\FormState.php).

Steps to reproduce

step 1. install Customerror module and enable it.
step 2. Try to login

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

viren18febS created an issue. See original summary.

viren18febs’s picture

Status: Active » Needs review
StatusFileSize
new631 bytes

I have fixed the issues and added a patch. please review

gisle’s picture

Assigned: viren18febs » Unassigned

We need someone else to review the patch.

shalini_jha’s picture

hi @gisle
I have tested the patch and it's working fine for me.
I am able to log in after enabling this module with this patch.

gisle’s picture

The patch works, put it is still not correct.

The statement:

$request->request->has('destination')

returns a boolean value (i.e. true or false). The patch tests whether this is value is !empty (which in PHP happens to be equivalent to true). However, doing so obfuscates the logic. We just want to check if this boolean value is true.

I've created a MR with the correct logic.

gisle’s picture

Status: Needs review » Fixed

Merged. Pipelines fail for unrelated causes.

It should be noted that the destination path is no correctly extracted, but the redirect still does not happen. See separate bug report: #3401346: Redirect after login does not work

Status: Fixed » Closed (fixed)

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