|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63639 posix_isatty and posix_ttyname weird var handling
Submitted: 2012-11-28 21:55 UTC Modified: 2013-10-02 07:08 UTC
From: antronin at gmail dot com Assigned:
Status: Not a bug Package: POSIX related
PHP Version: Irrelevant OS: Ubuntu 12.10
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: antronin at gmail dot com
New email:
PHP Version: OS:


 [2012-11-28 21:55 UTC] antronin at gmail dot com
From manual page:
Although documentation says "Returns TRUE if fd is an open descriptor connected 
to a terminal and FALSE otherwise." clearly this is not the case. 
It also returns TRUE if the parameter is not a file descriptor at all except is 
it is an integer < 3.

Test script:

for ($i=0; $i<50; $i++) {

Expected result:

(bool)false x50

Actual result:

(bool)false x47


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-10-02 07:08 UTC]
-Status: Open +Status: Not a bug
 [2013-10-02 07:08 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

Expecting integer parameters the arguments get converted, so:

true -> 1 -> STDOUT
false/'str'/array() -> 0 -> STDIN
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 20 02:01:28 2024 UTC