#26349 [NEW]: is_numeric() returns false for strings with more than 308 characters

From: Date: Fri, 21 Nov 2003 14:22:32 +0000
Subject: #26349 [NEW]: is_numeric() returns false for strings with more than 308 characters
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-50805@lists.php.net to get a copy of this message
From:             kouber at saparev dot com
Operating system: Win 2000 NT
PHP version:      4.3.4
PHP Bug Type:     Math related
Bug description:  is_numeric() returns false for strings with more than 308 characters

Description:
------------
is_numeric() always returns false for strings with more than 308
characters, even if all of them are digits.

308 = 255 + 63 = 2^8-1 + 2^6-1

Reproduce code:
---------------
<?
$s = str_repeat('6', 309);

var_dump($s);

var_dump(is_numeric($s));
?>

Expected result:
----------------
string(309)
"666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666"
bool(true)

Actual result:
--------------
string(309)
"666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666"
bool(false)

-- 
Edit bug report at http://bugs.php.net/?id=26349&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=26349&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=26349&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=26349&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=26349&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=26349&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=26349&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=26349&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=26349&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=26349&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=26349&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=26349&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26349&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=26349&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=26349&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=26349&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26349&r=float


Thread (3 messages)

« previous php.bugs (#50805) next »