|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-04-19 08:52 UTC] aharvey@php.net
-Status: Open
+Status: Bogus
[2011-04-19 08:52 UTC] aharvey@php.net
[2011-04-19 14:21 UTC] dosergio at ig dot com dot br
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 16 10:00:01 2025 UTC |
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...