From:             zuallauz at gmail dot com
Operating system: Ubuntu 12.04
PHP version:      5.4.3
Package:          *General Issues
Bug Type:         Bug
Bug description:5.4.3 regression, converting from float to int gives incorrect 
output

Description:
------------
Ok this code correctly works on 5.3.3 but I have since upgraded to 5.4.3
and it now incorrectly casts the float to an integer.

It occurs when converting the output from the log() function to an integer.
It should be a simple float to int conversion. However in the current
stable PHP it outputs the wrong integer for no apparent reason.

I have compiled PHP 5.4.3 release with the following if that helps:

./configure --with-zlib --with-gd --with-jpeg-dir --with-png-dir
--enable-gd-native-ttf --with-freetype-dir --enable-bcmath --enable-sockets
--with-openssl --with-pdo-mysql=mysqlnd
--with-mysql-sock=/var/run/mysqld/mysqld.sock --enable-mbstring
--enable-mbregex --with-curl --with-apxs2=/usr/local/apache2/bin/apxs
--with-config-file-path=/usr/local/apache2/conf

I consider this a critical bug so please fix ASAP.

Test script:
---------------
$logarithm = log(8, 2);
var_dump($logarithm);

$int = (int) $logarithm;
var_dump($int);

Expected result:
----------------
Expected output as it is in PHP 5.3.3:
float(3)
int(3)

Actual result:
--------------
Actual output in PHP 5.4.3:
float(3)
int(2)

-- 
Edit bug report at https://bugs.php.net/bug.php?id=62240&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=62240&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=62240&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=62240&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=62240&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=62240&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=62240&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=62240&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=62240&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=62240&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=62240&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=62240&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=62240&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=62240&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=62240&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=62240&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=62240&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=62240&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=62240&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=62240&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=62240&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=62240&r=mysqlcfg

Reply via email to