Edit report at https://bugs.php.net/bug.php?id=62240&edit=1
ID: 62240 Updated by: [email protected] Reported by: zuallauz at gmail dot com Summary: 5.4.3 regression, converting from float to int gives incorrect output Status: Open Type: Bug Package: *General Issues Operating System: Ubuntu 12.04 PHP Version: 5.4.3 Block user comment: N Private report: N New Comment: I am not able to reproduce this in PHP 5.4.4 Previous Comments: ------------------------------------------------------------------------ [2012-06-06 08:28:54] zuallauz at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=62240&edit=1
