|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-07-18 23:13 UTC] matysekj at usms dot org
$testnumber = 5000000000; echo $testnumber; The result is 2147483647. The variable is of type integer, even though it was initialized with a double value. I first noticed this with PHP 4.05 and it still occurs with 4.05. I do not believe it behaved this way back when I had 4.03PL1 installed. My configure line is: './configure' '--with-gd=no' '--with-mysql=/usr/local' '--with-config-file-path=/usr/home/priraise/phpini' '--enable-debug=no' '--enable-track-vars=yes' '--enable-ftp=yes' '--enable-force-cgi-redirect=yes' '--with-openssl' '--enable-trans-sid' '--enable-xml' PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 02:00:01 2025 UTC |
So you say that var_dump(5000000000) -> int(2147483647) And not, as expected: float(5000000000) PHP uses some system routines for that, this isn't coded in PHP. Zend/zend_language_scanner.l:line_1000: (...) errno = 0; /*long*/ lval = strtol(the_digit_as_a_string, NULL, 0); if (errno == ERANGE) { /* overflow */ (...) If strtol is doing his job right, there is no bug here... Are you sure this didn't happen with the older PHP-version, on the same box? Or is it just another pentium-bug (j/k) It would help if you try to execute these lines in C, and see wether ERANGE is set correctly. If it is, I'm lost. By the way, please try also some other values than 5 billion, some really huge values, and also some really negative values. Please use var_dump on them.