ID: 13407 Updated by: yohgaki Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Scripting Engine problem Operating System: PHP Version: 4.0.4pl1 New Comment:
Any update for this? Previous Comments: ------------------------------------------------------------------------ [2001-09-23 15:18:01] [EMAIL PROTECTED] I assume there somewhere needs to be one more than the index, for some reason... people should, IMHO, realize that computers have limited capacity for integer numbers, well, at least most languages do. And wether it goes wrong at max-1 or exactly at max, isn't really an issue IMO. You should not rely on the outer regions of the capacity of integer numbers. But there is one other reason why this isn't bogus after all, because $ar[ digits ] and $ar[ "digits" ] (digits := [0-9]+ ) should be equivalent. This is true inside the bounds (because both come down to an integer), and outside the bounds (because both come down to the same string). But for this case it is NOT true... ------------------------------------------------------------------------ [2001-09-23 15:06:43] [EMAIL PROTECTED] I assume there somewhere needs to be one more than the index, for some reason... people should, IMHO, realize that computers have limited capacity for integer numbers, well, at least most languages do. And wether it goes wrong at max-1 or exactly at max, isn't really an issue IMO. You should not rely on the outer regions of the capacity of integer numbers. But there is one other reason why this isn't bogus after all, because $ar[ digits ] and $ar[ "digits" ] (digits := [0-9]+ ) should be equivalent. This is true inside the bounds (because both come down to an integer), and outside the bounds (because both come down to the same string). But for this case it is NOT true... ------------------------------------------------------------------------ [2001-09-23 14:59:10] [EMAIL PROTECTED] Hrm.. Sure, that is the kneejerk response, but "too near"? 2147483647 is 2^31 - 1. I could understand if this happened at 2^31+1 and up, but not at 2^31 - 1. I'd like to see a better explanation of why this happens at instead of at 21474836478 ------------------------------------------------------------------------ [2001-09-23 14:52:16] [EMAIL PROTECTED] Integers are limited in capacity, you're too near the bounds of integer. If you need such high numbers, see GMP. Not a bug. (though technically it could be possible to let this single number work, the next one will fail.) Do a var_dump($ar) to see what happens. ------------------------------------------------------------------------ [2001-09-23 14:44:33] [EMAIL PROTECTED] $ar["2147483646"]="apples"; $ar["2147483647"]="oranges"; echo $ar[2147483646]; echo $ar[2147483647]; produces: apples ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=13407&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]