From: Antony Dovgal Date: Tue, 22 Mar 2005 15:09:20 +0000 (+0000) Subject: MFH: fix #28803 (enabled debug causes bailout errors with CLI on AIX X-Git-Tag: php-5.0.4RC2~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7d48c9c32d163b14e696828bf25a70699b92ee3d;p=php MFH: fix #28803 (enabled debug causes bailout errors with CLI on AIX because of fflush() called on already closed filedescriptor) --- diff --git a/NEWS b/NEWS index adeded37e1..4a9104d22f 100644 --- a/NEWS +++ b/NEWS @@ -150,6 +150,8 @@ PHP NEWS - Fixed bug #30106 (SOAP cannot not parse 'ref' element. Causes Uncaught SoapFault exception). (Dmitry) - Fixed bug #29989 (type re_registers redefined in oniguruma.h). (Moriyoshi) +- Fixed bug #28803 (enabled debug causes bailout errors with CLI on AIX + because of fflush() called on already closed filedescriptor). (Tony) - Fixed bug #29767 (Weird behaviour of __set($name, $value)). (Dmitry) - Fixed bug #29733 (printf() handles repeated placeholders wrong). (bugs dot php dot net at bluetwanger dot de, Ilia) diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 5e04ea6eca..8b527ba504 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -220,7 +220,10 @@ static int sapi_cli_ub_write(const char *str, uint str_length TSRMLS_DC) static void sapi_cli_flush(void *server_context) { - if (fflush(stdout)==EOF) { + /* Ignore EBADF here, it's caused by the fact that STDIN/STDOUT/STDERR streams + * are/could be closed before fflush() is called. + */ + if (fflush(stdout)==EOF && errno!=EBADF) { #ifndef PHP_CLI_WIN32_NO_CONSOLE php_handle_aborted_connection(); #endif