php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46422 php cli's interactive mode BLOCKs while using a fifo
Submitted: 2008-10-29 17:14 UTC Modified: 2008-10-29 18:25 UTC
From: i at iii dot dontexist dot net Assigned:
Status: Not a bug Package: CGI/CLI related
PHP Version: 5.2.6 OS: Centos 5
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: i at iii dot dontexist dot net
New email:
PHP Version: OS:

 

 [2008-10-29 17:14 UTC] i at iii dot dontexist dot net
Description:
------------
Hello, I would like to use "php -a" (php cli interactive mode) and input via a fifo.

it seems that while using it with a Character Device / Terminal.
it will behave accordingly.

but while piping its stdin .. it won't interact - it will block its stdout.

due to the fact it is an interactive mode, I can only assume its a misbehavior, I wouldn't expect interactive mode to block.


Reproduce code:
---------------
1. mkfifo fifo
2. cat fifo | strace php -a

3. cat > fifo
<?php echo "Hello World"; ?>

4. strace will reveal it been read, but nothing will be written back unless about 8K buffer stack is full, or EOF.



Expected result:
----------------
I expect "interactive mode" not to block while piping its STDIN. (without a Character Device / Terminal)


Actual result:
--------------
It would block unless EOF reached OR about 8K buffer is filled up.

and only then, it will write back to stdout.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-29 18:09 UTC] jani@php.net
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


 [2008-10-29 18:25 UTC] i at iii dot dontexist dot net
jani, thanks for the very fast response.

Unfortunately, I been googling for several days, and consulted 2 very populated IRC channels.

you responded: "This is not a bug".
which means.... what?

1. Environmental issue on my side?
2. Intentional feature of php cli?

Unless I've failed to understand what "Interactive mode" means.. I cannot see how this could possibly be the expected behavior?

Thanks a lot for the clarification.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 21:01:35 2025 UTC