php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11685 Bad Auto-Cast
Submitted: 2001-06-26 01:30 UTC Modified: 2001-06-29 20:59 UTC
From: Hot Soon<princeali at 263 dot net> Assigned: jeroen (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.6 OS: Windows 98 SE
Private report: No CVE-ID: None
 [2001-06-26 01:30 UTC] Hot Soon<princeali at 263 dot net>
Just run this program:
<?php
$var=-1073741824;
#####^ Here!

$var*=2;$var*=2;
var_dump($var);
?>

It will print out "int(0)".
but I believe it should print out"int(-2147483648)" or "float(-2147483648)" like this program:

<?php
$var=1073741824;
#####^ Here!

$var*=2;$var*=2;
var_dump($var);
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-26 07:55 UTC] jeroen@php.net
Indeed, +, -, and * 'autocasting' doesn't work in negative direction, only positive.
 [2001-06-26 17:10 UTC] zeev@php.net
Fixed in the latest CVS (will be fixed in 4.0.7)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 09:01:27 2024 UTC