ID: 22796 User updated by: gk at proliberty dot com Reported By: gk at proliberty dot com -Status: Feedback +Status: Open Bug Type: CGI related Operating System: linux RH 7.2 PHP Version: 4CVS-2003-03-19 (stable) New Comment:
I have tried your suggestion same test file and with: php4-STABLE-200303210630 (March 21) I get the same results: [EMAIL PROTECTED] junk]$ php -n -r 'require("junk.php");' begin [EMAIL PROTECTED] junk]$ php -r 'require("junk.php");' begin [EMAIL PROTECTED] junk]$ php junk.php begin Fatal error: Call to undefined function: f() in /usr/local/apache/htdocs/common/test/junk/junk.php on line 3 [EMAIL PROTECTED] junk]$ Perhaps the difference is in our configure options. Mine are: ./configure --with-dom --with-zlib-dir=/usr/include --with-mysql=/usr/local/mysql --with-apxs=/usr/local/apache/bin/apxs --with-xml --enable-track-vars Please let me know if we need to split this but into two: have you tested the issue of error messages not going to /dev/stderr or only the -r issue? Previous Comments: ------------------------------------------------------------------------ [2003-03-20 18:33:17] [EMAIL PROTECTED] I can not reproduce this with the latest stable snapshot: # php -n -r 'require("test.php");' begin /home/jani/test.php(3) : Fatal error - Call to undefined function: f() Try this. ('-n' is for not using any php.ini) ------------------------------------------------------------------------ [2003-03-20 03:21:11] gk at proliberty dot com changed title to be more acccurate ------------------------------------------------------------------------ [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