When I update to 7.x-1.13, I get the following error after run update.php:

The following updates returned messages

visitors module

Update #7130

  • Failed: PDOException: in visitors_update_7130() (line 156 of
    /var/www/cbmsupport.dk/public_html/sites/all/modules/visitors/visitors.install).

The read area in the picture is my own errormessages.

CommentFileSizeAuthor
Udklip.PNG43.02 KBuv516

Issue fork visitors-3311288

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

Uv516 created an issue. See original summary.

uv516’s picture

After 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).

bluegeek9 made their first commit to this issue’s fork.

bluegeek9’s picture

Assigned: Unassigned » bluegeek9
Issue summary: View changes

Hi @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).

uv516’s picture

I 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.

  • bluegeek9 committed 900821c on 7.x-1.x
    Issue #3311288 by bluegeek9: Update #7130-problem
    
bluegeek9’s picture

@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.

uv516’s picture

@bluegeek9: The website uses PHP 7.4.30. Databasesystem: "MySQL, MariaDB, or equivalent", Databasesystemversion: "5.7.39-42", Drupal: 7.92.

mattia.cristallo’s picture

Hi same problem here
waiting for the update version
Thanks

bluegeek9’s picture

@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.

mattia.cristallo’s picture

My 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

bluegeek9’s picture

@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.

bluegeek9’s picture

I have a pending pull request. Can you try it out? If it resolves the issue, I will make a 7.x-1.14 release.

uv516’s picture

@bluegeek9: Unfortunately, I cannot download from "pull request".
I get error: "https://www.drupal.org/git_error"

uv516’s picture

I 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).

dscutaru’s picture

Looks 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.

  • bluegeek9 committed bd1be43 on 7.x-1.x
    Issue #3311288 by bluegeek9: Update #7130-problem
    
bluegeek9’s picture

@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.

uv516’s picture

OBS: 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).

uv516’s picture

I installed "7.x-1.13+4-dev". It seems to work!

  • bluegeek9 committed 900821c on 7.x-2.x
    Issue #3311288 by bluegeek9: Update #7130-problem
    
  • bluegeek9 committed bd1be43 on 7.x-2.x
    Issue #3311288 by bluegeek9: Update #7130-problem
    
bluegeek9’s picture

Assigned: bluegeek9 » Unassigned
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.