php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69452 STDERR constant is undefined
Submitted: 2015-04-14 20:57 UTC Modified: 2015-05-03 04:22 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: padraic@php.net Assigned: cmb (profile)
Status: No Feedback Package: CGI/CLI related
PHP Version: master-Git-2015-04-14 (Git) OS: Ubuntu 14.10 32
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: padraic@php.net
New email:
PHP Version: OS:

 

 [2015-04-14 20:57 UTC] padraic@php.net
Description:
------------
The STDERR constant appears to be undefined showing:

Notice: Use of undefined constant STDERR - assumed 'STDERR' in /path/to/something.php on line 23

Example: https://travis-ci.org/padraic/humbug/jobs/58504971


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-04-15 08:43 UTC] laruence@php.net
STDERR only is pre-defined in cli api
 [2015-04-15 08:43 UTC] laruence@php.net
sapi
 [2015-04-15 09:47 UTC] laruence@php.net
-Status: Open +Status: Not a bug
 [2015-04-15 09:47 UTC] laruence@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


 [2015-04-16 09:59 UTC] padraic dot brady at gmail dot com
That's good to know, since Humbug is a CLI application...and it's clearly not defined.

The example links to a Travis build showing Humbug's tests passing under PHP5 and the failure with this notice under PHP7 which I though would be helpful. Apologies if I misunderstood, but it just looks like you closed this report without enough consideration.
 [2015-04-17 23:33 UTC] cmb@php.net
-Status: Not a bug +Status: Feedback -Assigned To: +Assigned To: cmb
 [2015-04-17 23:33 UTC] cmb@php.net
I've just checked with #r9a0cb73 (Windows):

> php -r "var_dump(STDERR);"
resource(3) of type (stream)

Padraic, please check again.
 [2015-04-18 14:43 UTC] padraic@php.net
https://travis-ci.org/padraic/humbug/jobs/58950141

This is running under Travis where the PHP version is described as: PHP 7.0.0-dev (cli) (built: Apr 16 2015 23:58:03). Same notice as previously reported. The STDERR appears undefined. The same tests under PHP5 pass without any issue.

So I cloned php-src and compiled a copy. Same resulting notice using the CLI sapi (after make; no make install).

PHP 7.0.0-dev (cli) (built: Apr 18 2015 13:14:50) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies
 [2015-04-18 14:52 UTC] cmb@php.net
-Status: Feedback +Status: Open -Assigned To: cmb +Assigned To:
 [2015-04-18 15:07 UTC] padraic@php.net
Using this compiled version from master, the simpler method described earlier does indeed pass however and report a resource. It appears to be something specific to the running of the tests that only occurs under PHP7. The syntax of the file using the STDERR being reported as undefined appears sound - and sparks no notice when isolated from the rest of the source code. Checking for the SAPI name, confirms it's definitely cli when the tests include that file and the notice is triggered.
 [2015-04-19 20:09 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2015-04-19 20:09 UTC] cmb@php.net
The issue is most likely not related to PHP 7, but rather to the
fact that Xdebug is not available for the PHP 7 Travis tests, and
only in this case line 23 of bootstrap.php is executed. I'm getting
the same notice on versions before PHP 7 if Xdebug is not
available.

Can you please confirm, Pádraic.

Further information: STDERR (as well as STDIN and STDOUT) is
generally not defined when using Symfony's PhpProcess class, at
least not on Windows (if Process::$enhanceWindowsCompatibility ==
true, what is the default) and on Cygwin, as the following snippet
confirms:

    $process = new Symfony\Component\Process\PhpProcess(
        '<?php echo STDERR; ?>'
    );
    $process->run();
    echo $process->getOutput();
 [2015-05-03 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 14 20:01:27 2024 UTC