The following PHP has filled up my logs for as long as I can remember running http:BL:

PHP Notice:  Undefined index: q in httpbl/httpbl.module on line 93

Comments

bryrock’s picture

Assigned: Unassigned » bryrock
Status: Active » Closed (works as designed)

Undefined index: q is a valid condition when $_GET['q'] is not set. It is only set when a page has a path (arguments) beyond the primary url. It is not set on a home page, for instance.

The fact that you are seeing Notices indicates that your PHP error reporting level is set to include them. The default reporting level in PHP 4 & 5 does not include notices. Notice level reporting is typically only used in development environments.

http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-repor...

danepowell’s picture

You are right of course that I should probably not be logging notices... oddly, although the documentation says that the default error_reporting level does not included notices, in actuality my php.ini does default to showing notices in production (PHP 5.3 on Ubuntu, from repos).

Anyway, thanks for a quick response and pointing out my oversight.

sagar ramgade’s picture

Hi,

Changing the error reporting level is not the solution, Change the line no 93 from :

if ($_GET['q'] == 'httpbl/whitelist') {

to

if (isset($_GET['q']) && $_GET['q'] == 'httpbl/whitelist') {
spidersilk’s picture

Sagar, thank you! That's very helpful. Not every site has complete control over their PHP configuration, so adjusting the code so that the issue doesn't come up is a better option than just living with an error log clogged with thousands of undefined index notices.

paulrooney’s picture

Issue summary: View changes
StatusFileSize
new758 bytes

Thanks Sagar. I have attached your solution as a patch.

akosipax’s picture

Status: Closed (works as designed) » Reviewed & tested by the community

I agree with Sagar. This patch should be committed.

  • paulrooney authored 8ec6635 on 6.x-2.x
    Issue #1332032 by paulrooney, bryrock, Sagar Ramgade: PHP Notice: "...
bryrock’s picture

Version: 6.x-2.0-rc1 » 6.x-2.x-dev
Status: Reviewed & tested by the community » Fixed

This has been committed. Should appear in next 6.x-2.x-dev.

  • bryrock committed 214eaa6 on 7.x-1.x authored by Sagar Ramgade
    Issue #1332032 by paulrooney, bryrock, Sagar Ramgade: PHP Notice: "...

Status: Fixed » Closed (fixed)

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