Problem/Motivation

When a user searches for something and edit the 'page' parameter in url with non numeric letters the website throws "The website encountered an unexpected error. Try again later." and shows this error TypeError: Unsupported operand types: string * string in Drupal\\google_json_api\\Plugin\\Search\\GoogleJsonApiSearch->execute() (line 164 of modules/contrib/google_json_api/src/Plugin/Search/GoogleJsonApiSearch.php).

Steps to Reproduce the Issue

1) Go to search page and search for any keyword.
2) In the URL, change the 'page' parameter from numeric to non numeric letters like search/google?keys=search&page=3. to search/google?keys=search&page=jhs#
This will result in the following error:
TypeError: Unsupported operand types: string * string in Drupal\\google_json_api\\Plugin\\Search\\GoogleJsonApiSearch->execute() (line 164 of modules/contrib/google_json_api/src/Plugin/Search/GoogleJsonApiSearch.php).

Proposed Resolution

simply adding an is_int() check to $page in /src/Plugin/Search/GoogleJsonApiSearch.php and /google_json_api/google_json_api.module fixes the issue.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rajkumar2030 created an issue. See original summary.

tanuj.’s picture

Issue summary: View changes
tanuj.’s picture

Status: Active » Needs review