Posted by anou on July 4, 2011 at 1:34pm
10 followers
| Project: | Custom Search |
| Version: | 7.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | major |
| Assigned: | Unassigned |
| Status: | needs review |
Issue Summary
Hello,
Working on a multi-language site.
When using the form on the top of the result page, I've got these 3 notices :
Notice : Undefined index: or in node_search_validate() (ligne 2738 in /modules/node/node.module).
Notice : Undefined index: negative in node_search_validate() (ligne 2743 in /modules/node/node.module).
Notice : Undefined index: phrase in node_search_validate() (ligne 2748 in /modules/node/node.module).if I don't have custom_search enabled, I've got no messages and search system is doing his job has expected.
Seems like maybe the system didn't like the deactivation of the advanced search ? Or something else...
Thanks for your help.
Comments
#1
After searching a bit, seems like custom_search is not defining these 3 variables :
I try to find where it should define them...
#2
I didn't had time to search a lot so I modified the node.module file (I know it's bad, but I'm naughty) :
Before line 2738, I insert :
if(!isset($form_state['values']['or'])){$form_state['values']['or']='';}if(!isset($form_state['values']['negative'])){$form_state['values']['negative']='';}
if(!isset($form_state['values']['phrase'])){$form_state['values']['phrase']='';}
Hope someone find something else...
Cheers.
#3
I'm also having this issue. Looks like this is a quick fix from the previous post.
Changed priority cause it looks like it has been sitting for a while and needs to be addressed.
#4
Ok, so it looks like this is only happening when you submit a search from the actual search page. When I submit a search from the "Search Form" block it doesn't run through the node_search_validate function so this error is never thrown.
Looking at the custom_search.module file it looks like the issue could have something to do with these lines...
106 if (!variable_get('custom_search_advanced_or_display', TRUE)) unset($form['advanced']['keywords']['or']);107 if (!variable_get('custom_search_advanced_phrase_display', TRUE)) unset($form['advanced']['keywords']['phrase']);
108 if (!variable_get('custom_search_advanced_negative_display', TRUE)) unset($form['advanced']['keywords']['negative']);
Simply changing the unset function to setting the variable to an empty string, which is what the error is wining about, didn't work :(
#5
In the DEV version, I've just changed
<?php
unset($form['advanced']['keywords']['or']);
unset($form['advanced']['keywords']['phrase']);
unset($form['advanced']['keywords']['negative']);
?>
by
<?php$form['advanced']['keywords']['or']['#type'] = 'hidden';
$form['advanced']['keywords']['phrase']['#type'] = 'hidden';
$form['advanced']['keywords']['negative']['#type'] = 'hidden';
?>
and the error seems to be gone.
Please test and review next DEV.
#6
I just uninstalled the release version and re-installed the dev version, and I'm still getting the error. I've doublechecked, and the changes you made to lines 110-112 are there. I've also cleared the cache and run cron, just in case there was something somehow left over from the previous version.
Still, no change.
#7
I also have the same error and made the changes suggested above - the error remains. I've reverted my file back to it's original state for the time being.
Any ideas?
#8
#9
The problem is if you have the 'Display advanced search' checkbox unchecked then it unsets the whole 'advanced' parent element.
This patch fixes it for me.
(sorry about the semi-unrelated coding standards fixes, I was finding it hard to follow without those - I can remove them if preferred)
The main part is:
- if (!variable_get('custom_search_results_advanced_search', TRUE)) unset($form['advanced']);-
+ if (!variable_get('custom_search_results_advanced_search', TRUE)) {
+ $form['advanced']['#type'] = 'hidden';
+ }
#10
I tried this solution, but it is not working for 7.x-1.9 version. The bug is still there :(
#11
@adelka:
As mentioned in #5, there have been some fixes done in the dev version.
Then my patch in #9 adds to that.
So you currently have to be using the dev version, with the patch in #9, until 7.x-1.10 comes out.
#12
The patch didn't work for me until I put an extra line break at the end?
All the credit goes to @rooby. I just added a line break.
#13
I actually have commit access now so I will commit this soon.