Req #10657 [Com]: Add warning about overflow to settype()
| From: | edgar dot r dot sandi at gmail dot com | Date: | Wed, 05 Nov 2014 20:55:14 +0000 |
| Subject: | Req #10657 [Com]: Add warning about overflow to settype() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-188470@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=10657&edit=1
ID: 10657
Comment by: edgar dot r dot sandi at gmail dot com
Reported by: tf at tfromm dot com
Summary: Add warning about overflow to settype()
Status: Open
Type: Feature/Change Request
Package: *General Issues
Operating System: linux
PHP Version: *
Block user comment: N
Private report: N
New Comment:
This script was created and tested in PHP 5.5.8 and PHP 5.6.2 with both situations described in this
Request and the outputs were correct with expected.
This request can be closed.
--TEST--
// phpt file: request10657.phpt
Request #10657 Add warning about overflow to settype()
--FILE--
<?php
// overflow integer
$foo = '11111111112';
settype($foo, "integer");
var_dump($foo);
// string -> integer
$bar = 'fjsfjsdh';
settype($bar, "integer");
var_dump($bar);
?>
--EXPECT--
int(11111111112)
int(0)
Previous Comments:
------------------------------------------------------------------------
[2014-11-05 20:55:13] edgar dot r dot sandi at gmail dot com
This script was created and tested in PHP 5.5.8 and PHP 5.6.2 with both situations described in this
Request and the outputs were correct with expected.
This request can be closed.
--TEST--
// phpt file: request10657.phpt
Request #10657 Add warning about overflow to settype()
--FILE--
<?php
// overflow integer
$foo = '11111111112';
settype($foo, "integer");
var_dump($foo);
// string -> integer
$bar = 'fjsfjsdh';
settype($bar, "integer");
var_dump($bar);
?>
--EXPECT--
int(11111111112)
int(0)
------------------------------------------------------------------------
[2001-05-04 02:50:32] tf at tfromm dot com
if i use settype($foo, "integer") with an value for $foo
alike '11111111112'
settype() returns successfull type setting and changes the
value to something like that '2147483647'
could it be possible that settype produces a warning, if
an value larger that the supported bitvalue of the current
system is and/or changes the value to 0 alike settype() on
a striong like this 'fjsfjsdh'...
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=10657&edit=1