Missing STDOUT, STDERR with CLI

Missing STDOUT, STDERR with CLI

am 13.11.2007 01:46:29 von unknown

Post removed (X-No-Archive: yes)

Re: Missing STDOUT, STDERR with CLI

am 13.11.2007 03:53:09 von nc

On Nov 12, 4:46 pm, ljb wrote:
>
> Using the PHP CLI executable, if the script to run is fed
> to PHP via standard input, then it seems PHP does not define
> any of the standard stream constants STDIN, STDOUT, and STDERR.
> While I can understand not defining STDIN, since that's where
> the script is, I think not defining STDOUT and STDERR is a bug.
> Any comments before I open a bug report?

Are you sure you're using CLI interpreter, not CGI one? What does
php_sapi_name() return?

Cheers,
NC

Re: Missing STDOUT, STDERR with CLI

am 13.11.2007 03:58:24 von Jerry Stuckle

ljb wrote:
> Using the PHP CLI executable, if the script to run is fed to PHP via
> standard input, then it seems PHP does not define any of the standard
> stream constants STDIN, STDOUT, and STDERR. While I can understand not
> defining STDIN, since that's where the script is, I think not defining
> STDOUT and STDERR is a bug. Any comments before I open a bug report?
> Confirmation?
>
> --- Test script 'nostd.php' ---
> > fwrite(STDOUT, "Hello, standard output\n");
> fwrite(STDERR, "Hello, standard error\n");
> -------------------------------
> Run: $ php nostd.php
> Works as expected.
> Run: $ php < nostd.php
> Produces NOTICE and Warning messages about STDOUT and STDERR not defined.
>

I've never tried it, but I can see why it could work that way.

When you do "php nostd.php", stdin is fed into the script, and stdout
and stderr would be, also. But, as you noticed, when you try to use
"php < nostd.php", stdin is redirected. So PHP probably doesn't open
stdout or stderr to the script, either.

You can try to submit it as a bug, but I'll give you good odds it will
be classified as "working as designed".

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: Missing STDOUT, STDERR with CLI

am 14.11.2007 00:15:55 von unknown

Post removed (X-No-Archive: yes)

Re: Missing STDOUT, STDERR with CLI

am 14.11.2007 00:19:16 von unknown

Post removed (X-No-Archive: yes)

Re: Missing STDOUT, STDERR with CLI

am 14.11.2007 03:17:48 von unknown

Post removed (X-No-Archive: yes)