|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49132 posix_times returns false without error
Submitted: 2009-08-01 17:42 UTC Modified: 2009-08-01 18:22 UTC
From: phpbugs at gunnu dot us Assigned:
Status: Closed Package: POSIX related
PHP Version: 6SVN-2009-08-01 (SVN) OS: Linux 2.6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: phpbugs at gunnu dot us
New email:
PHP Version: OS:


 [2009-08-01 17:42 UTC] phpbugs at gunnu dot us
/[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:
var_dump( posix_times() ); //returns false if uptime is high enough without setting error

Expected result:
A populated array

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-01 17:57 UTC] 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 @@


-       if((ticks = times(&t)) < 0) {
+       if((ticks = times(&t)) == -1) {
                POSIX_G(last_error) = errno;
 [2009-08-01 18:22 UTC]
Automatic comment from SVN on behalf of felipe
Log: - Fixed bug #49132 (posix_times returns false without error)
  patch by: phpbugs at gunnu dot us
 [2009-08-01 18:22 UTC]
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
Thank you for the report, and for helping us make PHP better.

Thanks for the patch. ;-)
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 15 00:01:28 2024 UTC