From:             ksours at internetbrands dot com
Operating system: CentOS
PHP version:      5.3.19
Package:          PHP options/info functions
Bug Type:         Bug
Bug description:Php CLI does not respect display_errors option to report to 
STDOUT. 

Description:
------------
Run the script from the command line using something like:
# php test.php > outstd.txt

Note that I get the same behavior setting the display_errors in the php.ini
instead of by the script.  The problem only occurs in the CLI and only on
Unix, Windows is fine.

The use case here is that I would like to be able to test the eval, capture
any errors, and report them via the app.  Having it randomly output stuff
to the stream messes up the reporting.  There does not appear to be anyway
to catch the output of STDERR with php using output buffering.  

Test script:
---------------
<?php
ini_set('display_errors', 'STDOUT');

include('foo');
ob_start();
eval ('foo alkadsjfladsjfladsfjl');
$foo = ob_get_contents();
ob_end_clean();
var_dump('xxx', $foo, 'xxx');
?>


Expected result:
----------------
PHP Warning:  include(foo): failed to open stream: No such file or
directory in /home/ksours/test.php on line 4
PHP Warning:  include(): Failed opening 'foo' for inclusion
(include_path='.:/php/includes:/usr/share/pear') in /home/ksours/test.php
on line 4
PHP Parse error:  syntax error, unexpected T_STRING in
/home/ksours/test.php(6) : eval()'d code on line 1

the outstd.txt will contain:
Warning: include(foo): failed to open stream: No such file or directory in
/home/ksours/test.php on line 4

Warning: include(): Failed opening 'foo' for inclusion
(include_path='.:/php/includes:/usr/share/pear') in /home/ksours/test.php
on line 4
string(3) "xxx"
string(102) "
Parse error: syntax error, unexpected T_STRING in /home/ksours/test.php(6)
: eval()'d code on line 1
"
string(3) "xxx"

Actual result:
--------------
No output to STDERR when display_errors is set to STDOUT.  It's also odd
that the output buffering captures the output, but its still displayed.

-- 
Edit bug report at https://bugs.php.net/bug.php?id=63701&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63701&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63701&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=63701&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=63701&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=63701&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=63701&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=63701&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=63701&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=63701&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=63701&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=63701&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=63701&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=63701&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63701&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=63701&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=63701&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=63701&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63701&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=63701&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63701&r=mysqlcfg

Reply via email to