From: Tim Starling Date: Fri, 18 Sep 2009 04:26:30 +0000 (+0000) Subject: Use STDERR instead of fopen('php://stderr') when possible X-Git-Tag: 1.31.0-rc.0~39654 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=ed22b3640725a56e99f22e21ae0e4c588fa74a49;p=lhc%2Fweb%2Fwiklou.git Use STDERR instead of fopen('php://stderr') when possible --- diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 452acf4772..27da73e02e 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -225,9 +225,13 @@ abstract class Maintenance { * @param $die boolean If true, go ahead and die out. */ protected function error( $err, $die = false ) { - $f = fopen( 'php://stderr', 'w' ); - fwrite( $f, $err . "\n" ); - fclose( $f ); + if ( php_sapi_name() == 'cli' ) { + fwrite( STDERR, $err . "\n" ); + } else { + $f = fopen( 'php://stderr', 'w' ); + fwrite( $f, $err . "\n" ); + fclose( $f ); + } if( $die ) die(); }