Edit report at https://bugs.php.net/bug.php?id=60565&edit=1
ID: 60565 Updated by: der...@php.net Reported by: lolautruche at gmail dot com Summary: $_SERVER['REQUEST_TIME'] is now a float but lacks a digit in Apache2 SAPI -Status: Open +Status: Bogus Type: Bug Package: Apache2 related Operating System: Mac OS X 10.7.2 (Lion) PHP Version: 5.4SVN-2011-12-19 (snap) Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php With 4 digits it also doesn't get parsed properly... as it will see those 4 digits as a year. You just shouldn't pass a float as a timestamp, as timestamps in PHP are integer seconds since the epoch. This is not a bug in PHP. Previous Comments: ------------------------------------------------------------------------ [2011-12-19 17:09:46] lolautruche at gmail dot com Description: ------------ As of PHP 5.4, $_SERVER['REQUEST_TIME'] is no longer an int, but a float. However, using Apache 2 SAPI, this server variable only have 3 decimal digits. This make DateTime::__construct() throw an exception : Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (@1324314320.916) at position 12 (9): Unexpected character' in /Users/lolautruche/workspace/test.php on line 3 As a comparison, FPM and built-in server defines 4 decimal digits, which is valid. This might affect Apache 1 SAPI as well. This also might be related to #55733 Test script: --------------- <?php var_dump( $_SERVER['REQUEST_TIME'] ); // Displays a float with 3 decimal digits with Apache2, 4 with FPM/built-in server $date = new DateTime( '@' . $_SERVER['REQUEST_TIME'] ); var_dump( $date ); Expected result: ---------------- $_SERVER['REQUEST_TIME'] should always have 4 decimal digits. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60565&edit=1