Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello! I'm always getting a log message about undefined user variable inside "src/ShieldMiddleware.php" file (line 79). I created a patch to solve this.
Comment | File | Size | Author |
---|---|---|---|
#7 | undefined_variable_user_fix-2990069-7.patch | 523 bytes | gantal |
Comments
Comment #2
andpet CreditAttribution: andpet as a volunteer commentedComment #3
andpet CreditAttribution: andpet as a volunteer commentedComment #4
geek-merlinThanks for reporting this! Yes code says this can happen. Alas, this patch will leave notices.
Fix this by guaranteeing $user is set also in the
switch case 'multikey'
code path.Comment #5
mmenavas CreditAttribution: mmenavas as a volunteer commentedI apologize I can't create a patch right now, but initializing
`$user`
before the switch statement has worked for me:Comment #6
gantal CreditAttribution: gantal at Elevated Third commentedInitializing
$user
before the `switch` block worked for me. Attaching a patch based on mmenavas's suggestion.Comment #7
gantal CreditAttribution: gantal at Elevated Third commentedSame patch as #6, just fixed the indentation. Whoops!
Comment #8
andpet CreditAttribution: andpet as a volunteer commentedComment #9
andpet CreditAttribution: andpet as a volunteer commentedYeah, works fine for me. Thanks!
Comment #10
andpet CreditAttribution: andpet as a volunteer commentedComment #12
geek-merlinComment #14
ccasals CreditAttribution: ccasals commentedWould you please add this to a stable release? Thanks!