getSearchWords() don't get the real search string

I have a little problem with display the real search string was write in the search field.


In the /themes/basic/search.php

array(1) {
  string(17) "000 "222 111" 333"

echo $_REQUEST['words'];

000 "222 111" 333

echo getSearchWords()

"000 222 111 333"

When i edit the function getSearchWords()in the /zp-core/class-search.php it's the same result.

function getSearchWords() {
return $_REQUEST['words'];


function getSearchWords() {
return $_POST['words'];

The real search string should be displayed.
000 "222 111" 333
Who or what removes the quotation marks?


  • acrylian Administrator

    The class constructor does this. The "search words" are not used in that way internally, they are processed by various class methods.

  • Quotation marks in search parameters tell search to use the quoted string literally. For instance, in your example, suppose you had the option set to treat spaces as an "AND." The search would then be on
    '000' & '222 111' & '333' e.g. three targets, all of which must be present.

    In your case, presumably the option is to treat spaces as spaces, so there is only one target. But the quotes still work the same. If you want actually to include quotation marks in your search parameter then you need to place them within quotations so they are taken literally. E.g. 000 '"'222 111'"' 333 will produce the output (and search) of 000 "222 111" 333.

    The algorithm which reconstructs the search string from the words will only supply the quotes when needed, Thus in your example there is no ambiguity and therefore no quotation marks.

Sign In or Register to comment.