php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48275 write errors to STDERR, by default
Submitted: 2009-05-14 07:14 UTC Modified: 2009-05-15 11:56 UTC
From: jidanni at jidanni dot org Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.9 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jidanni at jidanni dot org
New email:
PHP Version: OS:

 

 [2009-05-14 07:14 UTC] jidanni at jidanni dot org
Description:
------------
I can't believe that PHP writes its error messages to STDOUT by default
instead of STDERR. (At least you don't have them BOTH reversed.)

$ php lyrics.php |colrm 77

Warning: Unexpected character in input:  ''' (ASCII=39) state=1 in

Parse error: syntax error, unexpected ')' in /home/jidanni/audio/
$ php -r WRONG

Parse error: syntax error, unexpected $end in Command line code on line 1

At least on the _man page_ mention you are doing it on purpose because you fear it will flood some log or something.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-14 12:35 UTC] jani@php.net
You can set this without display_errors ini directive to whatever you 
want. This is not a bug. (see http://php.net/display_errors )
 [2009-05-15 11:45 UTC] jidanni at jidanni dot org
You need to patch as follows, as this is a man page for the command line usage, and there is no other command line program in UNIX that behaves like you do.

--- php5.1.orig	2009-05-15 19:30:05.000000000 +0800
+++ php5.1	2009-05-15 19:38:27.532490080 +0800
@@ -348,6 +348,8 @@
 certain input lines with your code. But note that in such cases $argi only 
 counts the lines being processed by php itself. Having read this you will 
 guess what the above program does: skipping every second input line.
+.SH ERROR REPORTING
+Use -d display_errors=stderr if one wants errors written to standard error.
 .SH TIPS
 You can use a shebang line to automatically invoke php
 from scripts. Only the CLI version of PHP will ignore
 [2009-05-15 11:56 UTC] jidanni at jidanni dot org
By the way, if you go for my patch, you might add that there is a subtle
difference where PHP puts its command line errors by default:
$ php -r ZZZZ|wc -l
2
$ php ZZZZ|wc -l
Could not open input file: ZZZZ
0
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 30 23:01:29 2024 UTC