php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17258 command line stdin order not honored
Submitted: 2002-05-15 14:30 UTC Modified: 2002-05-15 20:39 UTC
From: mlong at mlong dot org Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.2.1 OS: Compaq Tru64 5.1
Private report: No CVE-ID: None
 [2002-05-15 14:30 UTC] mlong at mlong dot org
Consider this simple script:

#!/usr/local/bin/php -q

<?
echo "TEST\n";

$fd=fopen("php://stdin","r");
$test=fgets($fd,4096);
?>

When I run it PHP immediately asks for stdin, then after I enter something it does the echo "TEST".  It's ignoring the order of my code!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-15 14:34 UTC] sander@php.net
Works fine for me on linux, this may be problem with terminal...
 [2002-05-15 14:58 UTC] mlong at mlong dot org
I guess it must be an issue with how php interacts with tru64
 [2002-05-15 18:44 UTC] edink@php.net
What are settings for implicit_flush and output_buffering in your php.ini? Try setting them to:

implicit_flush = On
output_buffering = Off

 [2002-05-15 20:29 UTC] mlong at mlong dot org
Yep that was it...when I turned output buffering off the problem went away.  Still strange behavior though...I would think asking for input should automatically flush any pending output
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Sep 18 22:01:26 2024 UTC