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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: Hot Soon<princeali at 263 dot net>
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 04:01:30 2025 UTC