Bug #79843 [Com]: Running intval to string value that is supposed to be INF returns 0

From: Date: Wed, 15 Jul 2020 01:14:53 +0000
Subject: Bug #79843 [Com]: Running intval to string value that is supposed to be INF returns 0
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228049@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79843&edit=1 ID: 79843 Comment by: taira dot 815 dot terashima at gmail dot com Reported by: taira dot 815 dot terashima at gmail dot com Summary: Running intval to string value that is supposed to be INF returns 0 Status: Open Type: Bug Package: Strings related Operating System: Ubuntu18.04 PHP Version: 7.4.8 Block user comment: N Private report: N New Comment: See this. <https://3v4l.org/1Pi3j> Previous Comments: ------------------------------------------------------------------------ [2020-07-15 01:13:28] taira dot 815 dot terashima at gmail dot com Oh, I see. Sorry, One digit missing. If Add 0 to number's last, result were 0. ------------------------------------------------------------------------ [2020-07-13 09:59:08] cmb@php.net For numbers exceeding PHP_INT_MAX, intval() is supposed to return PHP_INT_MAX; see <https://3v4l.org/tf7EJ>. ------------------------------------------------------------------------ [2020-07-13 09:46:37] taira dot 815 dot terashima at gmail dot com Description: ------------ Running function intval using a string value more than a certain number (maybe DOUBLE MAX) returns 0. Test script: --------------- <?php // It returns 0. (This string value is 2^1024) $number = intval('179769313486231570772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216'); echo $number; Expected result: ---------------- INF Actual result: -------------- 0 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79843&edit=1

« previous php.bugs (#228049) next »