Skip to content
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

integer overflow. #40

Closed
remicollet opened this issue Sep 16, 2013 · 2 comments
Closed

integer overflow. #40

remicollet opened this issue Sep 16, 2013 · 2 comments

Comments

@remicollet
Copy link
Collaborator

In the following example:

 <?php
 $key="testkey";
 $i=PHP_INT_MAX;
 apc_store($key, $i);
 var_dump($j=apc_fetch($key));
 var_dump($i);
 var_dump($i==$j);

 apc_inc($key, 1);
 $i++;
 var_dump($j=apc_fetch($key));
 var_dump($i);
 var_dump($i==$j);

We get:

 int(9223372036854775807)
 int(9223372036854775807)
 bool(true)
 int(-9223372036854775808)
 double(9.2233720368548E+18)
 bool(false)

Don't you think we should have consistent behavior between interger overflow in cache and in PHP var ?

P.S. I haven't test, but I think APC is also affected.

@jaydiablo
Copy link

APC behaves the same way (3.1.15-0.6)

int(9223372036854775807)
int(9223372036854775807)
boolean(true)
int(-9223372036854775808)
float(9.2233720368548E+18)
boolean(false)

@krakjoe krakjoe added wontfix and removed wontfix labels Aug 30, 2015
krakjoe added a commit that referenced this issue Aug 30, 2015
@krakjoe
Copy link
Owner

krakjoe commented Aug 30, 2015

Done for seven ;)

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

No branches or pull requests

3 participants