|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69105 posix_isatty(): could not use stream of type 'MEMORY'
Submitted: 2015-02-22 20:50 UTC Modified: 2015-12-02 19:53 UTC
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: ianbytchek at gmail dot com Assigned:
Status: Not a bug Package: Streams related
PHP Version: 5.6.6 OS: OS X 10.10.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: ianbytchek at gmail dot com
New email:
PHP Version: OS:


 [2015-02-22 20:50 UTC] ianbytchek at gmail dot com
I've raised the original issue at There's a very common check if the stream supports colours / interactivity by doing this:

return function_exists('posix_isatty') && @posix_isatty($stream);

But it fails for some reason and gives me this:

posix_isatty(): could not use stream of type 'MEMORY'

If I rewrite it with try … catch block it works:

try {
    return function_exists('posix_isatty') && posix_isatty($stream);
} catch (\Exception $exception) {
    return false;

But from what I understand that's what `@` in front of the first posix_isatty example call does. Did that change recently in 5.6 or what might be the problem here? I seem to be the only one who's getting this issue.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-02 19:53 UTC]
-Status: Open +Status: Not a bug
 [2015-12-02 19:53 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

posix_isatty() does not raise an exception in the 5.6 series. You can verify this with this simple script (also at

function test_posix_isatty() {
    return posix_isatty(fopen('php://memory', 'w'));


I suspect you have a global error handler that is translating warnings into exceptions. (Note in your example with the try...catch block, there is no @-silencer on posix_isatty.)
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 23 00:01:31 2024 UTC