php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #42091 STD IN/OUT/ERR undefined
Submitted: 2007-07-24 23:21 UTC Modified: 2007-07-25 00:11 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
From: eliteforce at elitemail dot org Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.2.3 OS: WinXP (SP2)
Private report: No CVE-ID: None
 [2007-07-24 23:21 UTC] eliteforce at elitemail dot org
Description:
------------
When running php.exe from the console without any arguments (so the script can be entered directly) the constants STDIN, STDOUT, STDERR are undefined.
When running the same code trough a file (php.exe <script>) or with the php.exe -r arg the constants are defined.

Reproduce code:
---------------
<?php
var_dump(defined('STDIN'));
var_dump(defined('STDOUT'));
var_dump(defined('STDERR'));
?>
^Z


Expected result:
----------------
bool(true)
bool(true)
bool(true)

Actual result:
--------------
bool(false)
bool(false)
bool(false)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-25 00:11 UTC] johannes@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

Offering these constants (aka opening the streams) before starting the execution might lead to some conflicts therefore these are disabled when script is passed from STDIN.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 05:01:28 2024 UTC