Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searching for commas & spaces alone yields Server Error #71

Closed
gitname opened this issue Sep 20, 2016 · 6 comments
Closed

Searching for commas & spaces alone yields Server Error #71

gitname opened this issue Sep 20, 2016 · 6 comments

Comments

@gitname
Copy link

gitname commented Sep 20, 2016

When I search for a string consisting of only spaces, by entering those spaces (encoded as %20s) directly into the address bar, the Grav Blog Skeleton demo site shows a "Server Error" page. This is shown in the Experiment C section below.


Experiment A. Search for non-whitespace characters, using search form:

I get a "0 results" message. I consider this to be the "by design" behavior.

image

Link: https://demo.getgrav.org/blog-skeleton/search/query:test


Experiment B. Search for whitespace characters only (i.e. 4 spaces, entered as ), using search form:

I get an "Error 404" page.

image

Link: https://demo.getgrav.org/blog-skeleton/search/query:


Experiment C: Search for whitespace characters only (i.e. 4 spaces, encoded as %20%20%20%20), using address bar:

I get a "Server Error" page containing information about the PHP code in use.

image

Link: https://demo.getgrav.org/blog-skeleton/search/query:%20%20%20%20

@gitname
Copy link
Author

gitname commented Sep 21, 2016

Experiment D: I see the same Server Error page when I search for a lone comma (i.e. ,).

Link: https://demo.getgrav.org/blog-skeleton/search/query:,

To demonstrate that this is not limited to searches performed by directly manipulating the URL; entering 2 spaces and a comma (i.e. ,) in the search form in the Blog Skeleton demo site yields the same result (the client-side validation prohibits submission of a comma alone).


I think, as long as the search box contains only commas, only spaces, or only commas and spaces, this error will occur.

@gitname
Copy link
Author

gitname commented Sep 21, 2016

I see the same behavior on a site I am developing. On that site, I am running Grav v1.1.5, Admin v1.2.2, and SimpleSearch v1.9.2.

@gitname gitname changed the title Searching for spaces via URL yields a Server Error Searching for commas & spaces alone yields Server Error Sep 21, 2016
gitname added a commit to gitname/grav-plugin-simplesearch that referenced this issue Sep 21, 2016
PHP delivers a warning when mb_stripos() is called with an empty string
as its second argument. The if() statement in this commit prevents it
from being called that way.

Fixes issue getgrav#71.
@coyoterj
Copy link

Hi,
When doing a search with comma at the end ( teste, ), this error occur:
selecao_015

@flaviocopes
Copy link
Contributor

Should be fixed now, if you can test @coyoterj @gitname

@flaviocopes
Copy link
Contributor

flaviocopes commented Dec 19, 2016

(not yet released, but in develop)

@coyoterj
Copy link

Hi @flaviocopes,

Tried to "bin/gpm update simplesearch", results:
"GPM Releases Configuration: Stable

Nothing to update."

Then, I updated the file simplesearch.php and that worked perfectly. ;)

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants