scrutinizer-ci / scrutinizer

Legacy repository - archives past feature requests/bug reports
https://scrutinizer-ci.com/docs
140 stars 36 forks source link

int + int * int wrongly interpreted as double #366

Open donatj opened 8 years ago

donatj commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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