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.
Any call to a website with Lightbox2 7.x-2.3 without HTTP_USER_AGENT variable set (one can easily emulate such request with Fiddler) results in a notice:
Notice: Undefined index: HTTP_USER_AGENT in lightbox2_add_files() (line 752 in /sites/all/modules/lightbox2/lightbox2.module).
I suggest changing
'useragent' => $_SERVER['HTTP_USER_AGENT'],
to
'useragent' => empty($_SERVER['HTTP_USER_AGENT']) ? '' : $_SERVER['HTTP_USER_AGENT'],
or something similar.
Comment | File | Size | Author |
---|---|---|---|
#4 | Lightbox2-undefined_index_http_user_agent_in_lightbox2-2749493-4.patch | 959 bytes | sandipshirsale |
Comments
Comment #2
sandipshirsale CreditAttribution: sandipshirsale at Clarion Technologies commentedComment #3
sandipshirsale CreditAttribution: sandipshirsale at Clarion Technologies commentedI have created patch. I hope this will help full for you.
Comment #4
sandipshirsale CreditAttribution: sandipshirsale at Clarion Technologies commentedPlease try this updated patch.
Comment #5
joseph.olstadHmm, requests from clients that refuse to divulge their HTTP_USER_AGENT usually means its originating from bots. Not sure how the best way to handle this is, maybe instead of putting in a blank string '' we should put in the string 'I am a bot refusing to divulge my http_user_agent and I am scanning your site and reporting back to the mother ship, kill this connection now'
Comment #6
victorlap@outlook.com CreditAttribution: victorlap@outlook.com commentedI communicate with a custom script with my drupal site. Had the same problem as OP. The solutions works! Thank you!
Comment #7
Ari Linn CreditAttribution: Ari Linn commentedAm getting the same error with Lightbox2 7.x-2.8. Is this fix not merged to master yet?
Comment #8
joseph.olstadok, I'll make another release for this. Didn't think it was much of an issue
Comment #11
joseph.olstad