-
Notifications
You must be signed in to change notification settings - Fork 83
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
Metadata's buildEpoch parsed as a string instead of integer. #119
Comments
If I had to guess, I would speculate that he is on a 32 bit system where gmp/bcmath is used for generating 64-bit integers. Could you confirm his platform and whether he is using the pure PHP implementation of this module or the maxminddb extension? |
Yes, I am on Ubuntu 18.04 32-bit. I'm not quite sure how to check whether it's using the PHP implementation or the maxminddb extension. |
@cnxsoft, would you be willing to share the output of |
php -i output: But shlink website is configured to use php7.4, so here's php7.4 -i output as well: I'm using a shlink 2.5.2 program using maxmind-db-reader. I'll let @acelaya answer about the exact version of the module used in the program. |
It's v1.9.0 |
It appears that you don't have the maxminddb extension or GMP installed. The string value is likely coming from BCMath. As an immediate fix, I think using the As for the larger issue, I think this module could cast the value if it is less than |
For now, I have worked around this in Shlink by doing a cast to int, with some extra checks to avoid silent errors. |
Make integers up to PHP_INT_MAX real integers. Closes #119
Hello.
I'm using this library in a project where I have a small mechanism to programatically update the GeoLite2 database file from time to time.
The logic is based on the database file build epoch, which I'm getting from the
MaxMind\Db\Reader\Metadata
object.This object states that the
buildEpoch
property is an integer:However, I have a user that has reported an error because that value is coming as a string, and is making a later statement fail because there's a type hint to
int
somewhere else.I haven't been able to reproduce it myself, but I have asked him to
var_dump
the metadata object, and it has been parsed as a string for him.I asked him to share his database file, and for me it's parsed as an integer, so I'm not sure what could be the difference.
Is there a known combination of circumstances in which this could end up happening?
I have considered just casting the value to integer always, but I'm afraid that could mask other errors that would be harder to identify later on.
The text was updated successfully, but these errors were encountered: