From 98f4ce9363b013fbaaa9f417e5bf276f5cbe7017 Mon Sep 17 00:00:00 2001 From: Adam Saponara Date: Thu, 9 Mar 2017 14:27:01 -0500 Subject: [PATCH] Return FALSE if error_log fails to write all bytes --- ext/standard/basic_functions.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 2f39f51ede..37d24d49bc 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -4682,6 +4682,7 @@ PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers) PHPAPI int _php_error_log_ex(int opt_err, char *message, size_t message_len, char *opt, char *headers) /* {{{ */ { php_stream *stream = NULL; + size_t nbytes; switch (opt_err) { @@ -4701,8 +4702,11 @@ PHPAPI int _php_error_log_ex(int opt_err, char *message, size_t message_len, cha if (!stream) { return FAILURE; } - php_stream_write(stream, message, message_len); + nbytes = php_stream_write(stream, message, message_len); php_stream_close(stream); + if (nbytes != message_len) { + return FAILURE; + } break; case 4: /* send to SAPI */ -- 2.40.0