php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36254 wrong xor result
Submitted: 2006-02-01 23:10 UTC Modified: 2006-02-01 23:29 UTC
From: mail at young dot org dot ua Assigned:
Status: Not a bug Package: Math related
PHP Version: 5.1.2 OS: 6.0-RELEASE-p4
Private report: No CVE-ID: None
 [2006-02-01 23:10 UTC] mail at young dot org dot ua
Description:
------------
Part of php-code doesnt work correctly on the sigle servers, but working good at ~100 other servers.

CPU: Intel(R) Pentium(R) 4 CPU 3.00GHz (3000.13-MHz 686-class CPU)

Reproduce code:
---------------
<?php
$a = -5883499359;
$b = 177392;
var_dump($a);
var_dump($b);
$a ^= $b;
var_dump($a);
?> 

Expected result:
----------------
float(-5883499359)
int(177392)
int(-1588438959)

Actual result:
--------------
float(-5883499359)
int(177392)
int(-2147306256)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-01 23:29 UTC] tony2001@php.net
Because bitwise operators work with integers and you're trying to use float/double values.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC