ID: 49132 Updated by: [email protected] Reported By: phpbugs at gunnu dot us -Status: Open +Status: Closed Bug Type: POSIX related Operating System: Linux 2.6 PHP Version: 6SVN-2009-08-01 (SVN) New Comment:
This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Thanks for the patch. ;-) Previous Comments: ------------------------------------------------------------------------ [2009-08-01 18:22:31] [email protected] Automatic comment from SVN on behalf of felipe Revision: http://svn.php.net/viewvc/?view=revision&revision=286629 Log: - Fixed bug #49132 (posix_times returns false without error) patch by: phpbugs at gunnu dot us ------------------------------------------------------------------------ [2009-08-01 17:57:59] phpbugs at gunnu dot us --- posix.c 2009-08-01 13:55:30.000000000 -0400 +++ posix.c.fix 2009-08-01 13:56:14.000000000 -0400 @@ -684,7 +684,7 @@ PHP_POSIX_NO_ARGS; - if((ticks = times(&t)) < 0) { + if((ticks = times(&t)) == -1) { POSIX_G(last_error) = errno; RETURN_FALSE; }) ------------------------------------------------------------------------ [2009-08-01 17:42:17] phpbugs at gunnu dot us Description: ------------ /[cvs]/php-src/ext/posix/posix.c rev 1.110 line 687 detects error if 'ticks' is a negative value. POSIX.1 states -1 is an error condition, but other negative values are acceptable overflow, which can be caused by a long uptime. posix_times() returns false under these conditions when there is no error except a long uptime. Reproduce code: --------------- <?php var_dump( posix_times() ); //returns false if uptime is high enough without setting error ?> Expected result: ---------------- A populated array Actual result: -------------- bool(FALSE) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49132&edit=1
