cubecart / v6

CubeCart Version 6
https://cubecart.com
72 stars 59 forks source link

Unknown Array Key #3507

Closed bhsmither closed 5 months ago

bhsmither commented 5 months ago

In User->isBot(), the web server might not include 'HTTP_USER_AGENT' when passing to PHP the $_SERVER array. Particularly when the client app does not send one, such as when implementing CURL (see #3044). (Another instance was dealt with in the Session class: #3252.) PHP further complains about passing a null to strtolower().

Suggest:

$agent = strtolower($_SERVER['HTTP_USER_AGENT'] ?? 'curl');

The string 'curl' is in the $_bot_sigs array.

If a web request does not contain a User Agent string, assume it is from something that is of no interest.

abrookbanks commented 5 months ago

Thanks.