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

Issue when multiple subdivisions are returned #7

Closed
losmicar opened this issue Jul 11, 2018 · 1 comment
Closed

Issue when multiple subdivisions are returned #7

losmicar opened this issue Jul 11, 2018 · 1 comment

Comments

@losmicar
Copy link

Hi,

Script will break when multiple subdivisions are returned from maxmind-db and this error will be logged: Expected comma or array end but found T_OBJ_BEGIN at character 980

Tested with this ip: 194.187.249.181 (France)

Script will try to return invalid constructed json that could not be parsed later on:

"subdivisions": [{
"geoname_id": 11071623,
"iso_code": "OCC",
"names": {
"en": "Occitanie",
"fr": "Occitanie"
}
} {
"geoname_id": 3036965,
"iso_code": "09",
"names": {
"de": "Ariège",
"en": "Ariège",
"es": "Arieja",
"fr": "Ariège"
}
}]

Comma is missing between these two objects.

I've personally solved it modifying the _dump_entry_data_list function where array is handled adding additional condition:

if size>0 then
table.insert(resultTab, ",");
end

Here is a print screen:
https://www.dropbox.com/s/u1jwuj03nkmzcbm/Screenshot%202018-07-11%2013.22.44.png?dl=0

Hope this helps,
Thanks

@anjia0532
Copy link
Owner

thanks a lot.

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

2 participants