No matter what you type in this box, when you click "Advanced search" it always plugs in a single keyword: "Array"... This is repeatable both on Drupal.org right now as well as in a brand new HEAD install from a few minutes ago.

Hovered between "normal" and "critical" but since it renders core functionality broken, I leaned towards critical. Feel free to downgrade if this is not appropriate.

CommentFileSizeAuthor
#10 adv_search.patch.txt1.17 KBZen
#4 search_ref.patch.txt1.07 KBZen

Comments

webchick’s picture

Status: Needs review » Active

Sorry, no patch. ;(

webchick’s picture

Title: "Containing any of the words" on advanced search doesn't work » keyword restrictions on advanced search don't work

And actually, looks like it does the same thing no matter what keyword-limiting stuff you plug in; it's not limited to the first box.

webchick’s picture

Title: keyword restrictions on advanced search don't work » Advanced search totally broken

*sigh* one more title change, then I'm leaving this alone. :P~ And it's definitely critical.

Using _any_ of the restirctions in advanced search will cause the keyword to be "Array" even if it's simply restricting to a certain node type or term.

Zen’s picture

Status: Active » Needs review
StatusFileSize
new1.07 KB

Attached is a patch that resets things to how it originally was - this works fine, but chx reckoned that this is not the correct way of using #ref.. I personally think that both ways are not terribly intuitive (or wrong):

My original patch:
-in _form, it was $form['tree']['processed_keys'] = ...
-in _validate, it was $form_values['processed_keys']['#ref'] = new value;
-in _submit, $form_values['processed_keys']['#ref'] returned the changed value;
Chx's patch:
-in _form, it was $form['tree']['processed_keys'] = ...
-in _validate, it was $form['tree']['processed_keys']['#ref'] = new value; <-- $form being the actual form and tree denoting the original tree.
-in _submit, $form_values['processed_keys'] returned the changed value;

Advanced search is returned by the node module. I tried adding $form['tree']['processed_keys']['#ref'] to the node modules _validate, to no avail - perhaps because it is called via a #validate callback and $form is not passed to it.
Ideally, it should be the inverse of my original patch:

-in _form, it should be $form['tree']['processed_keys']['#ref'] = ...
-in _validate, it should be $form_values['processed_keys'] = new value;
-in _submit, $form_values['processed_keys'] should return the changed value;

i.e. #ref should only be used in _form. Only form values with a #ref should be modifiable in _validate. Clean and simple? But tougher to implement..

My 10p,
-K

Zen’s picture

Apologies for the open tag.. Previews don't work in project atm.

Thanks
-K

Zen’s picture

And furthermore, in the above post it should be:

Chx's patch:
-in _form, it was $form['tree']['processed_keys'] = ...
-in _validate, it was $form['tree']['processed_keys']['#ref'] = new value; [$form being a third parameter to the _validate function, and tree indicating the complete path to the form value.
-in _submit, it $form_values['processed_keys'] returned the changed value.

This is the current implementation. The advanced form keys are returned by the node module's _validatee, wherein the $form['tree'] syntax isn't being used. I tried to add it in but it looks like $form is not passed to #validate callbacks.

Thanks and apologies for the flood :|
-K

chx’s picture

Status: Needs review » Needs work

NO! This makes absolutely no sense -- can't you see that you are setting something that does not exist and works only because it's a global variable?

Zen’s picture

Well, something is broken in forms api - if not the way #ref works currently, then it is: http://drupal.org/node/56921

-K

chx’s picture

erm not because it's a global variable but the way PHP handles globals and arrays in globals. again an array in an array and the reference to it..

Zen’s picture

StatusFileSize
new1.17 KB

node.module patched according as per the current #ref implmentation.

-K

Zen’s picture

Status: Needs work » Needs review

.

chx’s picture

Status: Needs review » Reviewed & tested by the community

Now, that's good to go.

killes@www.drop.org’s picture

Status: Reviewed & tested by the community » Fixed

applied

Anonymous’s picture

Status: Fixed » Closed (fixed)