#42154 [Ver->Csd]: settype() change data without warning!
| From: | vrana@php.net | Date: | Thu, 16 Aug 2007 10:09:30 +0000 |
| Subject: | #42154 [Ver->Csd]: settype() change data without warning! | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969377386@lists.php.net to get a copy of this message | ||
ID: 42154
Updated by: vrana@php.net
Reported By: tjibbe at rijpma dot org
-Status: Verified
+Status: Closed
Bug Type: Documentation problem
Operating System: linux
PHP Version: 5.2.3
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
"Maximum value for "int" is PHP_INT_MAX."
Previous Comments:
------------------------------------------------------------------------
[2007-08-01 13:13:49] tjibbe at rijpma dot org
Sorry i'm confused with float.
1.2345678901345678e+17 isn't the same integer as 12345678901234567890.
------------------------------------------------------------------------
[2007-08-01 12:25:04] tjibbe at rijpma dot org
or the Expected result should be:
1.2345678901345678e+17
------------------------------------------------------------------------
[2007-07-31 11:27:52] jani@php.net
Yes, the documentation in this needs a cleanup. I found this page
better explaining what happens and when/why:
http://www.php.net/intval
The http://www.php.net/manual/en/language.types.integer.php
page
requires some care too, it's too long. (split/add urls to topics,
whatever...)
------------------------------------------------------------------------
[2007-07-31 09:05:02] tjibbe at rijpma dot org
Description:
------------
The function gettype() changes your data without any notice of
warning!
In the documentation it is also not mentioned that settype($var, 'int')
has a max of 2147483647
Reproduce code:
---------------
<?php
error_reporting(E_ALL);
$var = '12345678901234567890';
settype($var, 'int');
echo $var;
?>
Expected result:
----------------
12345678901234567890
or
WARNING: settype() too big integer
Actual result:
--------------
2147483647
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42154&edit=1