From: Operating system: all PHP version: Irrelevant Package: *General Issues Bug Type: Bug Bug description:intval doesn't throw warning when value is bigger than the maximum allowed
Description: ------------ If you use intval with an argument that is bigger than 2147483647 the result will always be 2147483647. That's a problem that PHP doesn't throw an Error or Warning, because at the first glance, it looks like a mistery from where comes this magic number ? If someone used intval with an argument that is bigger than 2147483647 IMHO php should die with some message like this: 'Warning: Argument too big for intval. Maximum allowed is 2147483647' or 'Error: Argument too big for intval. Maximum allowed is 2147483647' I lost almost one hour to discover from where the magic number came... If there was the Error or Warning, it would be MUCH EASIER to solve the problem. Test script: --------------- <?php echo intval('11111111111'); ?> Expected result: ---------------- Throwing an Error (die) or Warning showing that the argument passed for intval was TOO BIG. Actual result: -------------- The function does NOT give any type of hint of the problem, and returns a fixed value 2147483647 as result, DOES NOT MATTER what the argument is, as long as it is bigger than 2147483647... -- Edit bug report at http://bugs.php.net/bug.php?id=54524&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54524&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54524&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54524&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54524&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54524&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54524&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54524&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54524&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54524&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54524&r=support Expected behavior: http://bugs.php.net/fix.php?id=54524&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54524&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54524&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54524&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54524&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54524&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54524&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54524&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54524&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54524&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54524&r=mysqlcfg