When Jump directly to the search result when there is only one result or Jump directly to the first search result even when there are multiple results is enabled and fires, I get white screen, with following messages being displayed an a next loaded page:

Warning: strpos() expects parameter 1 to be string, array given in url_is_external() (line 2311 of /path/to/site/includes/common.inc).
Warning: substr() expects parameter 1 to be string, array given in url_is_external() (line 2315 of /path/to/site/includes/common.inc).
Warning: strpos() expects parameter 1 to be string, array given in drupal_strip_dangerous_protocols() (line 1350 of /path/to/site/includes/common.inc).
Warning: strpos() expects parameter 1 to be string, array given in url() (line 2196 of /path/to/site/includes/common.inc).
Warning: substr() expects parameter 1 to be string, array given in url() (line 2197 of /path/to/site/includes/common.inc).
Warning: strpos() expects parameter 1 to be string, array given in drupal_strip_dangerous_protocols() (line 1350 of /path/to/site/includes/common.inc).
Warning: strpos() expects parameter 1 to be string, array given in url() (line 2212 of /path/to/site/includes/common.inc).
Warning: explode() expects parameter 2 to be string, array given in url() (line 2213 of /path/to/site/includes/common.inc).

Comments

alex.bukach’s picture

Assigned: alex.bukach » Unassigned
Status: Active » Needs review
StatusFileSize
new701 bytes

The bug was caused by the fact that when jumping to a node, the module tried to redirect to $node->path, while $node->path is an array. The patch has fallback for the case if $node->path is string.

hwasem’s picture

This patch saved me! We just upgraded our site and are using Search404. Each time someone links from an old URL and it found only one match, they were redirected with a whole bunch of these errors in OP. With patch, it is just the little note with "The page you requested does not exist. A search for XXXXXX resulted in this page." Yay! It works great.

alan d.’s picture

Title: White screen when jump option is enabled » White screen (WSOD) when jump option is enabled
Status: Needs review » Needs work

It is simple as this I believe:

$result_path = drupal_get_path_alias('node/' . $results['#results'][0]['node']->nid);

i.e. ditch the "if (isset($results['#results'][0]['node']->path)) {" conditional altogether

This still throws a WSOD (server dependent) in some cases, like if path auto installed but the node doesn't have an alias.

$node->path === array(pathauto => 0)

gunzip’s picture

will this be committed to stable version ? it's somewhat critical...

anish.a’s picture

Assigned: Unassigned » anish.a
Issue tags: +WSOD
anish_zyxware’s picture

Assigned: anish.a » anish_zyxware
anish_zyxware’s picture

StatusFileSize
new684 bytes

Patch that uses method mentioned in #3

drupal_get_path_alias() returns unaliased path if aliased path is not there.

anish_zyxware’s picture

Status: Needs work » Closed (fixed)