Comments (9)
I don't think InfluxDB accept float or double values as timestamp, need to be check.
Another strange behavior is if you put a string in input like '2015-10-27 14:17:40', the method isValidTimestamp will return true because of PHP behavior.
The first test (int)$timestamp === $timestamp will be false, but we continue to check... that's not a good behavior. And in the second check PHP will consider the string as a numeric value (1) and the test $timestamp <= PHP_INT_MAX && $timestamp >= ~PHP_INT_MAX will be true. So the method return true on string values...
from influxdb-php.
I don't think InfluxDB accept float or double values as timestamp, need to be check.
I don't expect it to, but the timestamp check function should accept nanosec timestamps which it doesn't. Right now its very much borked.
from influxdb-php.
In fact, it can't work on 32bits systems, but on 64bits system it's supported until this date: 294247-01-09 20:00:54 which is I think long enough :-p
On 32bits systems: PHP_MAX_INT is equal to 2,147,483,647 (10 digits)
On 64bits systems: PHP_MAX_INT is equal to 9,223,372,036,854,775,807 (19 digits)
from influxdb-php.
@andig what @mermetbt says is correct. We expect the script to be run on 64 bit systems only.
from influxdb-php.
In fact, it can't work on 32bits systems
True for the current implementation. If you wanted to support 32 bits you could allow doubles or even strings and use ctype_digit
from influxdb-php.
ctype_digit won't work because it doesn't accept the - character (which means you cannot supply dates before the unix epoch). There are cases where you might need to enter dates before the unix epoch. However we will add the following statement to the isValidTimestamp method:
// if the code is run on a 32bit system, loosely check if the timestamp is a valid numeric
if (PHP_INT_SIZE == 4 && is_numeric($timestamp) && intval($timestamp) == $timestamp) {
return true;
}
from influxdb-php.
@andig this issue has been addressed in 1.2.x
from influxdb-php.
It maybe me who doesn't get it, but intval will again be limited to 32bits. Doubles arent- so stay with isnumeric instead?
from influxdb-php.
@andig correct i will have to remove the intval() function from the equation. I'm retagging 1.2.1 with this change. Thanks!
from influxdb-php.
Related Issues (20)
- PhP my Admin HOT 1
- Adding new query methods?
- [Question Only] Is it usable with InfluxDB 2.0 HOT 12
- [Feature request] Parameter Binding HOT 2
- Exception using getPoints on empty metric HOT 3
- Contact request
- Client results differ vs CLI HOT 2
- Can you add a parameter to QueryBuilder->getResultSet() ? HOT 1
- get the return result when save points with curl driver HOT 1
- HTTPS Request, not HTTP
- getResultSet(['epoch' => 's']) HOT 2
- select query with different time format HOT 3
- PHP 8 compatibility HOT 6
- InfluxDB2\FluxRecord getValue() can spit out a PHP “Undefined Index” Notice HOT 1
- Code 500
- Incorrect PRECISION_NANOSECONDS marker
- Can't omit port if running influxdb behind reverse proxy HOT 1
- Isn't 202 a valid status code as well?
- TypeError with php 8.1
- Identify repo owner and move to InfluxCommunity org HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from influxdb-php.