ID: 22796 User updated by: gk at proliberty dot com -Summary: fatal messages go to stdout; to /dev/null with -r option Reported By: gk at proliberty dot com Status: Open Bug Type: CGI related Operating System: linux RH 7.2 PHP Version: 4CVS-2003-03-19 (stable) New Comment:
changed title to be more acccurate Previous Comments: ------------------------------------------------------------------------ [2003-03-20 01:57:17] gk at proliberty dot com I am using GNU bash, version 2.05.8(1)-release (i386-redhat-linux-gnu) It isn't just FATAL messages that are lost with -r option, warnings also vanish into the bit-bucket. #FILE: junk.php <?php include("non_existent_file"); ?> #OUTPUT: [EMAIL PROTECTED] junk]$ php -r 'include("junk.php");' [EMAIL PROTECTED] junk]$ php junk.php Warning: main(non_existent_file): failed to open stream: No such file or directory in /usr/local/apache/htdocs/common/test/junk/junk.php on line 3 Warning: main(): Failed opening 'non_existent_file' for inclusion (include_path='.:/usr/local/apache/htdocs/common/php:/usr/local/lib/php') in /usr/local/apache/htdocs/common/test/junk/junk.php on line 3 [EMAIL PROTECTED] junk]$ ------------------------------------------------------------------------ [2003-03-19 18:42:56] gk at proliberty dot com I'm using php4-STABLE-200303191630 Problem is with sapi/cli/php The problem has TWO, possibly related parts: 1. when cli/php is invoked with script argument, FATAL error messages go to /dev/stdout instead of /dev/stderr, making it difficult to handle errors properly 2. when cli/php is invoked with -r '...' option, error messages are lost ENTIRELY, although output preceding the fatal command is not. //test.php <?php echo "begin\n"; f(); // undefined function; fatal error echo "end\n"; ?> #OUTPUT OF SCRIPT: [EMAIL PROTECTED] junk]$ php "test.php" begin Fatal error: Call to undefined function: f() in /usr/local/apache/htdocs/common/test/junk/test.php on line 3 [EMAIL PROTECTED] junk]$ php "test.php" 1>/dev/null [EMAIL PROTECTED] junk]$ php -r 'require "test.php";' begin [EMAIL PROTECTED] junk]$ ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22796&edit=1