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

Zoom Search is not performing input validation on INT columns #16248

Closed
anksh1997 opened this issue Jul 5, 2020 · 4 comments
Closed

Zoom Search is not performing input validation on INT columns #16248

anksh1997 opened this issue Jul 5, 2020 · 4 comments
Assignees
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Milestone

Comments

@anksh1997
Copy link
Contributor

Describe the bug

When we are using zoom search on a table validations are failing because of the fix id of table search form in validation function.

To Reproduce

Steps to reproduce the behavior:

  1. Select any table
  2. Click on Search tabl
  3. Click on Zoom Search subtab
  4. Select any INT field in first / second row of first column
  5. Enter invalid value in input field.

Expected behavior

It should display appropriate message after successful validation just like in table serach form.

Screenshots

Now
image

Expected After chaning id to zoom_search_form in validation function
image

pma_version: 5.0.3-dev
browser_name: CHROME
browser_version: 83.0.4103.116
user_os: Linux
server_software: Apache
php_version: 7.3.16

@williamdes williamdes added the Bug A problem or regression with an existing feature label Jul 5, 2020
@ibennetch ibennetch changed the title INT Validations are failing in Zoom Search Form Zoom Search is not performing input validation on INT columns Jul 5, 2020
@ibennetch
Copy link
Member

I edited the subject of this report.

Thank you for reporting.

@ibennetch
Copy link
Member

ibennetch commented Jul 5, 2020

With QA_5_0 I get this JavaScript error:

{
    "pma_version": "5.0.3-dev",
    "browser_name": "FIREFOX",
    "browser_version": "78.0",
    "user_os": "Mac",
    "server_software": "nginx/1.14.2",
    "user_agent_string": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Firefox/78.0",
    "locale": "en",
    "configuration_storage": "disabled",
    "php_version": "7.4.7",
    "script_name": "tbl_zoom_select.php",
    "exception_type": "js",
    "exception": {
        "mode": "stack",
        "name": "TypeError",
        "message": "$.data(...) is undefined",
        "stack": [
            {
                "func": "rules",
                "line": "164",
                "column": "17",
                "context": [
                    "\t\tif ( element.form == null ) {",
                    "\t\t\treturn;",
                    "\t\t}",
                    "",
                    "\t\tif ( command ) {",
                    "\t\t\tsettings = $.data( element.form, \"validator\" ).settings;",
                    "\t\t\tstaticRules = settings.rules;",
                    "\t\t\texistingRules = $.validator.staticRules( element );",
                    "\t\t\tswitch ( command ) {",
                    "\t\t\tcase \"add\":",
                    "\t\t\t\t$.extend( existingRules, $.validator.normalizeRule( argument ) );"
                ],
                "uri": "js/vendor/jquery/jquery.validate.js?v=5.0.3-dev",
                "scriptname": "js/vendor/jquery/jquery.validate.js"
            },
            {
                "func": "validateIntField",
                "line": "208",
                "column": "17",
                "context": [
                    " * @returns {void}",
                    " */",
                    "function validateIntField (jqueryInput, returnValueIfIsNumber) {",
                    "    var mini = parseInt(jqueryInput.data('min'));",
                    "    var maxi = parseInt(jqueryInput.data('max'));",
                    "    jqueryInput.rules('add', {",
                    "        number: {",
                    "            param: true,",
                    "            depends: function () {",
                    "                return returnValueIfIsNumber;",
                    "            }"
                ],
                "uri": "js/table/change.js?v=5.0.3-dev",
                "scriptname": "js/table/change.js"
            },
            {
                "func": "verifyAfterSearchFieldChange",
                "line": "174",
                "column": "29",
                "context": [
                    "            Messages.strEnterValidNumber",
                    "            );",
                    "            validateMultipleIntField($thisInput, true);",
                    "        } else {",
                    "            $('#tbl_search_form').validate();",
                    "            validateIntField($thisInput, true);",
                    "        }",
                    "    }",
                    "}",
                    "",
                    "/**"
                ],
                "uri": "js/table/change.js?v=5.0.3-dev",
                "scriptname": "js/table/change.js"
            },
            {
                "func": "onchange",
                "line": "1",
                "column": "8",
                "context": [
                    "",
                    "",
                    "",
                    "  ",
                    "  "
                ],
                "uri": "tbl_zoom_select.php?",
                "scriptname": "tbl_zoom_select.php"
            }
        ],
        "uri": "tbl_zoom_select.php?"
    }
}

With master, it just silently fails.

@anksh1997
Copy link
Contributor Author

anksh1997 commented Jul 5, 2020

Can I work on this ? :)
I can think of a solution
we can pass searchType identifier in verifyAfterSearchFieldChange function to change id dynamically

@ibennetch
Copy link
Member

ibennetch commented Jul 5, 2020 via email

@williamdes williamdes added the has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete label Jul 5, 2020
@williamdes williamdes added this to the 5.0.3 milestone Jul 5, 2020
@williamdes williamdes self-assigned this Jul 7, 2020
williamdes added a commit that referenced this issue Jul 7, 2020
…idation on INT columns

Merge: #16249
Fixes: #16248
Signed-off-by: William Desportes <williamdes@wdes.fr>
williamdes added a commit that referenced this issue Jul 7, 2020
Signed-off-by: William Desportes <williamdes@wdes.fr>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Projects
None yet
Development

No branches or pull requests

3 participants