My site was upgrading from D6 to D7 with this module previously installed in D6. So it also being upgrade from 6.x to 7.x.
When I try to perform any invalid term, these error come out.

Notice: Undefined index: host in search404_search_engine_query() (line 96 of /home/parasolx/domains/parasolx.net/public_html/sites/all/modules/search404/search404.module).
Notice: Undefined index: query in search404_search_engine_query() (line 97 of /home/parasolx/domains/parasolx.net/public_html/sites/all/modules/search404/search404.module).

i have tried uninstall and re-install, but these error still come out.

CommentFileSizeAuthor
#7 search404.module.patch505 bytesjoelstein
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

picsofle’s picture

I get the same error.

skadu’s picture

Wanted to confirm I am experiencing the same problem. This issue seems to occur when users try to visit a page directly on the site. Line 94 ( $parsed_url = parse_url($_SERVER['HTTP_REFERER']); ) assumes that you have been referred to the page by a search engine. When the following lines attempt to get the host and query information from the $parse_url array, they return undefined. It seems that parse_url stops at [path] if there was no referrer, instead of crating the full array (http://php.net/manual/en/function.parse-url.php).

My fix was to check to see if the keys were set in the parsed url and if they were assign them to the $remote_host and $query variables, otherwise, I set those variables to nothing. This seems to have removed the notices. Not sure if this way you want to handle it within the module or not.

if(isset($parsed_url['host']))
	{	
		$remote_host = $parsed_url['host'];
	}
	else
	{
		$remote_host = "";
	}
	if(isset($parsed_url['query']))
	{
		$query_string = $parsed_url['query'];
	}
	else
	{
		$query_string = "";
	}
Peter Bowey’s picture

Issue tags: +Notice: Undefined index xxx

See entry at http://drupal.org/node/1111918

Peter Bowey

zyxware’s picture

Assigned: Unassigned » zyxware
Category: support » bug
Priority: Critical » Minor
Status: Active » Fixed

Thanks for the report. I have fixed this in the latest 7.x-1.x dev branch.

Status: Fixed » Closed (fixed)

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

joostvdl’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Closed (fixed) » Active

I downloaded the dev release, but I still suffer this issue:

Notice: Undefined index: host in search404_search_engine_query() (regel 95 van /srv/www/kaipara_nl/dev/htdocs/sites/all/modules/search404/search404.module).
Notice: Undefined index: query in search404_search_engine_query() (regel 96 van /srv/www/kaipara_nl/dev/htdocs/sites/all/modules/search404/search404.module).
joelstein’s picture

Status: Active » Needs review
FileSize
505 bytes

Me too, I don't see this changed at all in dev. Attached is a two-line patch which fixes the issue.

rootwork’s picture

Priority: Minor » Major

This also was not changed in the latest dev for me. The patch in #7 fixed it for me.

carusen’s picture

Version: 7.x-1.x-dev » 7.x-1.0

I have this issue as well.

The patch seems to have fixed the issue. Shouldn't it be applied to an official release and save others the trouble of patching stuff by themselves?

rootwork’s picture

Well, the point was that it hasn't even been applied to the dev release. But yes, that would be ideal.

zyxware’s picture

Version: 7.x-1.0 » 7.x-1.x-dev

Sorry about the mixup. The patch has been applied in the 7.x-1.x branch and should be available in the dev release in 24 hrs.

http://drupalcode.org/project/search404.git/blobdiff/9670197a0f8a6374dc8...

zyxware’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

viktor.mastoridis’s picture

On Drupal 7 I am getting these Notices although I patched the two various patches mentioned here and on another similar topic. I also installed the dev-module, but no joy there either. I get these error messages when I enter a wrong web-address manually. And I can't seem to be able to disable the php notices anyway, as I am on a shared hosting plan (site5)

 Notice: Undefined index: module in ds_search_form_search_form_alter() (line 387 of ~/sites/all/modules/ds/modules/ds_search/ds_search.module).
    * Notice: Undefined index: module in custom_search_form_alter() (line 103 of ~/sites/all/modules/custom_search/custom_search.module). 
viktor.mastoridis’s picture

I couldn't solve the above mentioned errors in Drupal 7, so I emailed the support staff of site5.com (my host) who placed a php.ini file in the /public_html folder with:
display_errors = Off

It didn't help.

I was still getting the notices (and complaining:-), till another member of their staff edited the settings.php file and added this line:
ini_set('error_reporting', E_ALL & ~E_NOTICE);

Now the notices are gone.

I provide this in case someone needs a quick fix for the Notices in Drupal 7 created by the Search 404 module;