Skip to content
This repository has been archived by the owner on Apr 12, 2018. It is now read-only.

int + int * int wrongly interpreted as double #366

Open
donatj opened this issue Feb 1, 2016 · 2 comments
Open

int + int * int wrongly interpreted as double #366

donatj opened this issue Feb 1, 2016 · 2 comments

Comments

@donatj
Copy link

donatj commented Feb 1, 2016

https://scrutinizer-ci.com/g/capdig/myon/inspections/8818fbf4-e222-4d0e-81b0-ccf1a14f369c/issues/files/application/routes/www/exams/placement.php?status=new&orderField=path&order=asc&honorSelectedPaths=0

screen shot 2016-02-01 at 15 40 41

I am being told that an integer time() + an integer \WM\ONE_MINUTE * 25 _(integer)_ is a double.

This is plainly wrong.

@fgm
Copy link

fgm commented Jul 8, 2016

Not necessarily: if the value overflows PHP_INT_MAX (sometime in 2038 for 32-bit builds), it will be converted to a double, AIUI. Won't it ?

@donatj
Copy link
Author

donatj commented Jul 8, 2016

@fgm Any int could overflow though, should every int then be documented as int|double?

I set plenty of int documented params to ints elsewhere without this complaint, so I assume it's a time() issue... So on a 64 bit system in the year 292,277,026,596 my int becomes a double and that's worth complaining about? I mean alright, 32 bit systems, which are all ready rare, we will need to worry about the 2038 bug, but I feel like 32 bit systems, let alone PHP will probably be out of style before then.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants