Closed (fixed)
Project:
Visitors (Web Analytics)
Version:
7.x-1.13
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Sep 2022 at 19:53 UTC
Updated:
12 Oct 2022 at 00:44 UTC
Jump to comment: Most recent
Comments
Comment #2
uv516 commentedAfter failed update I now get the error:
PDOException: in visitors_exit() (line 219 of /var/www/cbmsupport.dk/public_html/sites/all/modules/visitors/visitors.exit.inc).
Comment #4
bluegeek9 commentedHi @Uv516,
Thank you for reporting the bug. Are you using just the visitors module, or also the visitors GeoIp module?
The error happens when it tries to update the datebase with the new IP address format. I'll try to get patch and then a new release out soon.
It looks like there was an issue converting one or more IP addresses from the IPv4 only format `long2ip` to the new IPv6 and IPv4 format `inet_pton`. But, from the screenshot I was able to get the IPv4 address (176.58.100.196).
Comment #5
uv516 commentedI am not using the GeoIp module?
I tried it years ago and found it not working. I live with that.
Yes, the error happenens when updating the database with new IP adress.
I have Visitors on all sites (app. 8 sites) and the error is showing on all sites.
Because of the error, I get
PDOException: i visitors_exit() (linje 219 af /var/www/www.pkt-kursus.dk/www/sites/all/modules/visitors/visitors.exit.inc).too.
That is a "break down" to the website. I is not enough to disable the module Visitors. I have to uninstall it now.
Comment #7
bluegeek9 commented@Uv516,
I think you can fall back to the 7.x-1.12 release. Just replace the module, nothing fancy.
I have updated the 7.x-1.x-dev branch. It wraps the database insert in a try/catch. It will not fix the problem, but it will catch the exception and might tell us the problem.
I read something about inet_pton/inet_ntop working differently on different hardware, or maybe it was ip2long/long2ip
Which version of PHP are you running? PHP >= 5.1.0 ?
Do you know the server's architecture/processor type?
I suppose the database column could be increased, and the IP address stored as a string. Storing it as a string instead of another value would also solve #3016442: Visitors 7.x Views support.
P.S. I intentionally delayed the release of 8.x-2.13 in case there were issues with IPv6.
Comment #8
uv516 commented@bluegeek9: The website uses PHP 7.4.30. Databasesystem: "MySQL, MariaDB, or equivalent", Databasesystemversion: "5.7.39-42", Drupal: 7.92.
Comment #9
mattia.cristalloHi same problem here
waiting for the update version
Thanks
Comment #10
bluegeek9 commented@Uv516 and @mattyy21,
I am leaning towards storing the IP address as a string, and releasing a patch soon.
I am unable to reproduce the error. I would like to know more about it. Have either of you tried the 7.x-1.x-dev branch? The exception is being caught and logged to the database. I am hoping the exception message will confirm my proposed solution will fix the error.
Comment #11
mattia.cristalloMy website:
Drupal 7.92
PHP 7.4.30
DB version 5.5.5-10.3.35-MariaDB-log-cll-lve
visitors_geoip disabled
In update.php with the stable release 7.x-1.13 i have the follow error
The following updates returned messages
visitors module
Update #7130
Failed: PDOException: in visitors_update_7130() (linea 156 di /sites/all/modules/visitors/visitors.install).
!!Works with the dev version!!
Thanks for the support
Comment #12
bluegeek9 commented@mattyy21,
Are there any message in 'Recent log messages' about visitors? The dev branch doesn't fix the issue, only catch the exception and logs it to the database.
Comment #14
bluegeek9 commentedI have a pending pull request. Can you try it out? If it resolves the issue, I will make a 7.x-1.14 release.
Comment #15
uv516 commented@bluegeek9: Unfortunately, I cannot download from "pull request".
I get error: "https://www.drupal.org/git_error"
Comment #16
uv516 commentedI tried to install version 7.x-2.x-dev, but got this error:
PDOException: i visitors_exit() (linje 309 af .../sites/all/modules/visitors/visitors.exit.inc).Comment #17
dscutaru commentedLooks like what inet_pton returns mysql(mariadb in my case) does not consider valid utf8 string
SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value: '\xC0\xA8\x01\x01' for column `db`.`visitors`.`visitors_ip` at row 1
Update/Work around: all works fine after changing visitors_ip type from varchar to varbinary in table structure.
Comment #19
bluegeek9 commented@dscutaru,
Thank for the information of varchar to varbinary. I think using a regular sting and a larger column is the right decision. Compatibility with SQLite, and PostgreSQL could be hard.
@Uv516,
I merged the changes into 7.x-1.x-dev. Thank you for reporting this bug quickly. If it solves the problem I'll make a 7.x-1.14 release today, and 7.x-2.0-alpha11.
Comment #20
uv516 commentedOBS: This thread is started before bluegeek9's (#19).
dscutaru is right:
inet_pton converts an ip-address to 4 characters each with a chr value that the ip-address has.
Eg. is 127.0.0.1 recast to (string) chr(127).chr(0).chr(0).chr(1).
This is no problem when the ip-address only contains segments between 0 and 127, each representing its own ascii character set.
If you try the same with e.g. 192.168.1.1 (private address), inet_pton will form a character for chr(192) ( À = Latin capital letter A with grave) and chr(168) ( ¨= diaeresis). Both of these charaters is illegal as column value in some DBs.
If you use raw ip(4)-address in the column visitors_ip there will be no errors (there!)
This is tested in module "visitors.exit.inc"'s function "visitors_exit", app. from line 287 ( $ip_str = visitors_get_ip_str(); ) to ( $fields = array( ).
The visitor.install make a column with utf8_general_ci (as normal).
Comment #21
uv516 commentedI installed "7.x-1.13+4-dev". It seems to work!
Comment #23
bluegeek9 commented