ID: 22796 Comment by: michael dot mauch at gmx dot de Reported By: gk at proliberty dot com Status: Feedback Bug Type: CGI related Operating System: linux RH 7.2 PHP Version: 4CVS-2003-03-19 (stable) New Comment:
With php4-STABLE-200303241430 (and with 4.3.1), I can get even three error messages for the same error. # sapi/cli/php -c php.ini-dist -r 'f();' Command line code(1) : Fatal error - Call to undefined function: f() # sapi/cli/php -c php.ini-recommended -r 'f();' PHP Fatal error: Call to undefined function: f() in Command line code on line 1 Command line code(1) : Fatal error - Call to undefined function: f() # sed 's/\(display_.*errors = \)Off/\1On/' <php.ini-recommended >php.ini-display-errors # sapi/cli/php -c php.ini-display-errors -r 'f();' PHP Fatal error: Call to undefined function: f() in Command line code on line 1 Command line code(1) : Fatal error - Call to undefined function: f() Fatal error: Call to undefined function: f() in Command line code on line 1 This last php.ini is with display_errors and display_startup_errors = On. The message starting with "Fatal error:" goes to stdout, the other two to stderr. Previous Comments: ------------------------------------------------------------------------ [2003-03-24 04:12:26] [EMAIL PROTECTED] And get first the latest stable snapshot again. ------------------------------------------------------------------------ [2003-03-24 04:11:54] [EMAIL PROTECTED] # php -r "f();" Command line code(1) : Fatal error - Call to undefined function: f() This is what I get when using the php.ini-dist from the latest stable CVS snapshot. As you can see, we get totally different style of error messages too. Please try with the plain, unmodified php.ini-dist instead of your current php.ini. ------------------------------------------------------------------------ [2003-03-24 02:11:34] gk at proliberty dot com I split this bug into two; changed the title to better reflect what I have learned: it is possible to work around this bug by changing the default value of display_startup_errors in php.ini: --- #default value #display_startup_errors = Off display_startup_errors = On --- Now I get the proper error message: [EMAIL PROTECTED] php4-STABLE-200303210630]# sapi/cli/php -r "f();" Fatal error: Call to undefined function: f() in Command line code on line Following sniper's advice of using -n to prevent reading php.ini has the same effect for me as display_startup_errors = Off; apparently it doesn't have the same result for sniper. Odd. ------------------------------------------------------------------------ [2003-03-21 20:09:38] gk at proliberty dot com I built it again, per your instructions and get the same result: [EMAIL PROTECTED] php4-STABLE-200303210630]# sapi/cli/php -n -r "require('/htdocs/common/test/junk/junk.php');" begin [EMAIL PROTECTED] php4-STABLE-200303210630]# Do I need a more recent snapshot than that? I'm using the same test file: /htdocs/common/test/junk/junk.php: <?php echo "begin\n"; f(); // undefined function; fatal error echo "end\n"; ?> ------------------------------------------------------------------------ [2003-03-21 17:13:42] [EMAIL PROTECTED] Try this with latest stable snapshot: # rm config.cache # ./configure --disable-all --disable-cgi && make clean && make # sapi/cli/php -n -r "require('test.php');" I think you're just doing something wrong / have something setup very differently in your server.. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/22796 -- Edit this bug report at http://bugs.php.net/?id=22796&edit=1