If I'm not mistaken, that is to be expected. That's because you're on a 32 bit system, so the maximum possible int (PHP_INT_MAX) is 2147483647. Now, normally PHP could cast to a float to get the larger number in, but you explicitly cast it to an integer, so it had to truncate the value.
Try var_dump($s + 0); which correctly results in a float of the correct value. But the problem is that you asked for the int type, which overflowed... Anthony PS: You can use http://codepad.viper-7.com/ to test 5.2, 5.3, 5.4 and Trunk (I believe they do nightly builds of each)... On Sat, Nov 19, 2011 at 8:46 AM, Paul Dragoonis <dragoo...@gmail.com> wrote: > Hey guys, > > I don't have a dev environment on my mac here so I can't upgrade to > TRUNK to test so I'm relying on someone on the internals list to test > this. > > ---- PHP INFO ---- > 5.3.1 > > ------ ISSUE ---- > Simple integer work, converting it from being wrapped in a zval.type of > string, > into int. Same value would be expected but it's giving an arbitrary value. > > I can't test on latest php 5.3.x as I don't have a dev environment > setup on this > machine. So i'm relying on some mac user to test using trunk and verify. > > ----- OS ---- > MAC OSX 10.7.2 > Darwin Paul-Dragooniss-MacBook-Pro.local 11.2.0 Darwin Kernel Version > 11.2.0: Tue > Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64. > > > ---- CODE --- > $s = "2433078805"; > var_dump($s); > var_dump((int) $s); exit; > > ----- EXPECTED ----- > string(10) "2433078805" int(2433078805) > > ----- ACTUAL ----- > string(10) "2433078805" int(2147483647) > > > Random or what? > > Regards, > Paul Dragoonis. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php