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

JavaScript error while editing JSON in grid #14301

Closed
TonyLianLong opened this issue May 17, 2018 · 27 comments
Closed

JavaScript error while editing JSON in grid #14301

TonyLianLong opened this issue May 17, 2018 · 27 comments
Assignees
Labels
Bug A problem or regression with an existing feature help wanted
Projects
Milestone

Comments

@TonyLianLong
Copy link

Steps to reproduce

  1. write long JSON (more than 50 characters) into a column
  2. edit it in the browse tab
  3. then this JavaScript error occurred -- A fatal JavaScript error has occurred. Would you like to send an error report?

Expected behaviour

It should be normal editing

Actual behaviour

The JavaScript exception
Uncaught SyntaxError: Unexpected token . in JSON at position 50

Debugged in JavaScript, I found the code in makegrid.js tried to parse the shorthand version of the value and trying to parse '[{"steps": [{"text": "AA", "type": "java", "title"...' will not work because the part after the 50th character is omitted and replaced by "...".

image

The JSON value was read from which should be from another source because the one in is the shorthand version with only the first 50 characters, not the full JSON code.

Server configuration

Operating system:
Linux(in docker)
Web server:
Nginx
Database:
MySQL 8.0.3-rc-log
PHP version:
7.2.4
phpMyAdmin version:
4.8.0.1

Client configuration

Browser:
Chrome 64
Operating system:
maxOS 10.13.4

@sunzongzheng
Copy link

same

@redzru
Copy link

redzru commented May 28, 2018

4.8.1 / MySQL 8.0.11 is same error...

@Optimae
Copy link

Optimae commented May 29, 2018

Same error here, using 4.8.1

@mesaglam
Copy link

Yes, i faced this problem too...

@redzru
Copy link

redzru commented Jun 22, 2018

4.8.2 still not fix... Someone listen?

@SirDeadlystrike
Copy link

Can confirm - Running into this as well

@williamdes
Copy link
Member

@SirDeadlystrike TL;DR Can you send test data, it would help :)

@SirDeadlystrike
Copy link

SirDeadlystrike commented Jul 27, 2018

@williamdes
Seems to be exactly whats stated above - Phpmyadmin is truncating json objects causing a parse error in the grid view.

Here is a object we use that triggers said issue
{"aotc": "2017-02-02T03:34:00.000Z", "summary": "0/10 N", "total_bosses": 10, "heroic_bosses_killed": 0, "mythic_bosses_killed": 0, "normal_bosses_killed": 0}

The Error:
php-error-1
and an example of a table structure we encounter the issue on
php-test-2

When we cut down the object to somthing like
{"summary": "3/3 M", "total_bosses": 3}
it works fine

@TonyLianLong
Copy link
Author

The only way I've figured out to skip the problem is to select "Full Text" in the option and phpMyAdmin will show the full JSON content in the grid, and then it works file.

@sharifzadesina
Copy link

same here

@sharifzadesina
Copy link

sharifzadesina commented Sep 18, 2018

Any fix for this? @MauricioFauth

@jeffnst
Copy link

jeffnst commented Sep 27, 2018

same too, the way to hide this error i set "Limit column characters" to 100,
cause my JSON only 54chr .... hehehe...
PHPmyadmin -> Version information: 4.8.2

@williamdes williamdes added the Bug A problem or regression with an existing feature label Oct 11, 2018
@lancemitchell
Copy link

Any update on this issue. Getting same error in 4.8.3, worked great in 4.7.9

@codex-corp
Copy link

codex-corp commented Nov 28, 2018

same issue in 4.8.2

{
    "pma_version": "4.8.2",
    "browser_name": "CHROME",
    "browser_version": "70.0.3538.102",
    "user_os": "Win",
    "server_software": "Apache/2.4.18 (Ubuntu)",
    "user_agent_string": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36",
    "locale": "en",
    "configuration_storage": "enabled",
    "php_version": "7.2.12-1+ubuntu16.04.1+deb.sury.org+1",
    "exception_type": "js",
    "exception": {
        "mode": "stack",
        "name": "SyntaxError",
        "message": "Unexpected end of JSON input",
        "stack": [
            {
                "line": "292",
                "func": "",
                "uri": "index.php?v=4.8.2",
                "scriptname": "index.php"
            },
            {
                "func": "JSON.parse",
                "line": "",
                "column": "",
                "uri": "index.php?",
                "scriptname": "index.php"
            },
            {
                "func": "Object.showEditCell",
                "line": "604",
                "column": "53",
                "uri": "index.php?v=4.8.2",
                "scriptname": "index.php"
            },
            {
                "func": "startGridEditing",
                "line": "1948",
                "column": "23",
                "uri": "index.php?v=4.8.2",
                "scriptname": "index.php"
            },
            {
                "func": "HTMLTableCellElement.",
                "line": "2039",
                "column": "25",
                "uri": "index.php?v=4.8.2",
                "scriptname": "index.php"
            },
            {
                "func": "HTMLTableCellElement.new_func",
                "line": "248",
                "column": "33",
                "uri": "index.php?v=4.8.2",
                "scriptname": "index.php"
            },
            {
                "func": "HTMLTableCellElement.dispatch",
                "line": "2",
                "column": "41772",
                "uri": "index.php?v=4.8.2",
                "scriptname": "index.php"
            },
            {
                "func": "HTMLTableCellElement.$event.dispatch",
                "line": "374",
                "column": "19",
                "uri": "index.php?v=4.8.2",
                "scriptname": "index.php"
            },
            {
                "func": "HTMLTableCellElement.y.handle",
                "line": "2",
                "column": "39791",
                "uri": "index.php?v=4.8.2",
                "scriptname": "index.php"
            }
        ],
        "incomplete": "false",
        "partial": "true",
        "uri": "index.php?"
    },
    "script_name": "index.php",
    "microhistory": null
}

@bs-thomas
Copy link

Same error on 4.8.4

@williamdes
Copy link
Member

Param Value
Error Type SyntaxError
Error Message Unexpected end of JSON input
Exception Type js
phpMyAdmin version 4.8.0.1
Incident count 9059
Link Report#49161

This comment is posted automatically by phpMyAdmin's error-reporting-server.

@williamdes
Copy link
Member

Param Value
Error Type SyntaxError
Error Message Unexpected end of JSON input
Exception Type js
phpMyAdmin version 4.8.0-dev
Incident count 2148
Link Report#38278

This comment is posted automatically by phpMyAdmin's error-reporting-server.

@Gethin0321
Copy link

is still not fixed?

@sharifzadesina
Copy link

It is a shame to say, but NO.

@williamdes williamdes added this to High priority in issues Apr 29, 2019
@williamdes
Copy link
Member

williamdes commented May 2, 2019

@Gethin0321 @sharifzadesina or someone else, can you send me detailed steps to reproduce this issue ?
I can not reproduce this issue and I was trying to reproduce it in order to make a fix.

If possible try on demo servers (root, no password)

@lancemitchell
Copy link

@Gethin0321 @sharifzadesina or someone else, can you send me detailed steps to reproduce this issue ?
I can not reproduce this issue and I was trying to reproduce it in order to make a fix.

If possible try on demo servers (root, no password)

* [`5.0.0-dev`](https://demo.phpmyadmin.net/master/)

* [`4.8.x`](https://demo.phpmyadmin.net/QA_4_8/)

Hello @williamdes, I have created a table called "canpis" in a database called "JSONTEST" on the Demo server "demo.phpmyadmin.net". View table using the following URL

JSONTEST Error Demo

To reproduce the issue, simply attempt to edit the JSON by double-clicking the "conf" column

image

@williamdes
Copy link
Member

@lancemitchell Can you please paste an export on Github of the database since the demo servers get reset quite frequently..
Thanks for helping!

I will have a look tomorrow (UTC+2)
Time to sleep ⌚

@lancemitchell
Copy link

@lancemitchell Can you please paste an export on Github of the database since the demo servers get reset quite frequently..
Thanks for helping!

I will have a look tomorrow (UTC+2)
Time to sleep ⌚

Here is an import file of the "canpis" table that you can import into a database of your choosing
canpis.zip

Regards

@williamdes
Copy link
Member

Thanks @lancemitchell
I know why I was not reproducing this issue, I was using MariaDB
This issue occurs on MySQL and PerconaDB

@williamdes williamdes added this to the 4.8.6 milestone May 4, 2019
@williamdes williamdes self-assigned this May 4, 2019
williamdes added a commit that referenced this issue May 4, 2019
Duplicate: #14699
Signed-off-by: William Desportes <williamdes@wdes.fr>
@williamdes
Copy link
Member

This issue is now fixed and will be part of the next release
You can apply the patch 821dce6 locally and report if you still have an issue before we release 4.8.6 :)

@sharifzadesina
Copy link

At least :)
Thank you.

issues automation moved this from High priority to Closed May 4, 2019
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 21, 2020
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 help wanted
Projects
issues
  
Closed
Development

No branches or pull requests