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.
Using Shield 8.x-1.x, I've got a notice when accessing for the first time, and get the basic auth form.
Notice : Undefined offset: 1 in Drupal\shield\ShieldMiddleware->handle() (line 69 of /web/modules/contrib/shield/src/ShieldMiddleware.php).
Comment | File | Size | Author |
---|---|---|---|
#10 | shield-undefined-offset-2794899-10.patch | 937 bytes | badjava |
#5 | shield_undefined_offset-2794899-5.patch | 1.02 KB | flocondetoile |
Comments
Comment #2
flocondetoileComment #3
flocondetoileIt's because for the first check if the visitor is not authenticated, the $request->server->has('HTTP_AUTHORIZATION') is present but empty.
the tiny patch attached fix these notices.
Comment #4
flocondetoileSeems it's not sufficient.
Comment #5
flocondetoileThe good patch attached
Comment #6
flocondetoileComment #7
swentel CreditAttribution: swentel commented+1 - patch applies with offset, but does the trick.
Comment #8
badjava CreditAttribution: badjava at Metasun for Pfizer, Inc. commentedThe patch fixes the issue but why do we even do the ->has checks on the two elseif statements? They are returning true but with an empty value so it seems pointless unless I am missing something.
Comment #9
swentel CreditAttribution: swentel commentedMakes sense, probably just an !empty() check is good enough.
Comment #10
badjava CreditAttribution: badjava at Metasun for Pfizer, Inc. commentedHere is an updated patch with the changes discussed in #8 and #9.
Comment #11
badjava CreditAttribution: badjava at Metasun for Pfizer, Inc. commentedRaising the priority of this issue since it's causing PHP errors on the stable release.
Comment #12
kmoll CreditAttribution: kmoll at Appnovation for Pfizer, Inc. commentedI tested this patch and it fixes the php notice I get when testing it without the patch with the 8.x-1.x version.
Comment #13
kmoll CreditAttribution: kmoll at Appnovation for Pfizer, Inc. commentedComment #15
badjava CreditAttribution: badjava at Metasun for Pfizer, Inc. commentedThanks everyone for helping fix this issue.